Package org.eclipse.jetty.util
Class TypeUtil
- java.lang.Object
-
- org.eclipse.jetty.util.TypeUtil
-
@Deprecated(since="2021-05-27") public class TypeUtil extends Object
Deprecated.The Eclipse Jetty and Apache Felix Http Jetty packages are no longer supported.TYPE Utilities. Provides various static utility methods for manipulating types and their string representations.- Since:
- Jetty 4.1
-
-
Constructor Summary
Constructors Constructor Description TypeUtil()
Deprecated.
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static <T> List<T>
asList(T[] a)
Deprecated.Array to List.static Object
call(Class<?> oClass, String methodName, Object obj, Object[] arg)
Deprecated.static Object
construct(Class<?> klass, Object[] arguments)
Deprecated.static Object
construct(Class<?> klass, Object[] arguments, Map<String,Object> namedArgMap)
Deprecated.static byte
convertHexDigit(byte c)
Deprecated.static int
convertHexDigit(char c)
Deprecated.static int
convertHexDigit(int c)
Deprecated.static void
dump(Class<?> c)
Deprecated.static void
dump(ClassLoader cl)
Deprecated.static byte[]
fromHexString(String s)
Deprecated.static Class<?>
fromName(String name)
Deprecated.Class from a canonical name for a type.static URI
getClassLoaderLocation(Class<?> clazz)
Deprecated.static URI
getClassLoaderLocation(Class<?> clazz, ClassLoader loader)
Deprecated.static URI
getCodeSourceLocation(Class<?> clazz)
Deprecated.static URI
getLocationOfClass(Class<?> clazz)
Deprecated.Attempt to find the Location of a loaded Class.static URI
getModuleLocation(Class<?> clazz)
Deprecated.static URI
getSystemClassLoaderLocation(Class<?> clazz)
Deprecated.static boolean
isFalse(Object o)
Deprecated.static boolean
isTrue(Object o)
Deprecated.static byte[]
parseBytes(String s, int base)
Deprecated.static int
parseInt(byte[] b, int offset, int length, int base)
Deprecated.Parse an int from a byte array of ascii characters.static int
parseInt(String s, int offset, int length, int base)
Deprecated.Parse an int from a substring.static String
toClassReference(Class<?> clazz)
Deprecated.Return the Classpath / Classloader reference for the provided class file.static String
toClassReference(String className)
Deprecated.Return the Classpath / Classloader reference for the provided class file.static void
toHex(byte b, Appendable buf)
Deprecated.static void
toHex(int value, Appendable buf)
Deprecated.static void
toHex(long value, Appendable buf)
Deprecated.static String
toHexString(byte b)
Deprecated.static String
toHexString(byte[] b)
Deprecated.static String
toHexString(byte[] b, int offset, int length)
Deprecated.static String
toName(Class<?> type)
Deprecated.Canonical name for a type.static String
toString(byte[] bytes, int base)
Deprecated.static Object
valueOf(Class<?> type, String value)
Deprecated.Convert String value to instance.static Object
valueOf(String type, String value)
Deprecated.Convert String value to instance.
-
-
-
Field Detail
-
NO_ARGS
public static final Class<?>[] NO_ARGS
Deprecated.
-
CR
public static final int CR
Deprecated.- See Also:
- Constant Field Values
-
LF
public static final int LF
Deprecated.- See Also:
- Constant Field Values
-
-
Method Detail
-
asList
public static <T> List<T> asList(T[] a)
Deprecated.Array to List.Works like
Arrays.asList(Object...)
, but handles null arrays.- Type Parameters:
T
- the array and list entry type- Parameters:
a
- the array to convert to a list- Returns:
- a list backed by the array.
-
fromName
public static Class<?> fromName(String name)
Deprecated.Class from a canonical name for a type.- Parameters:
name
- A class or type name.- Returns:
- A class , which may be a primitive TYPE field..
-
toName
public static String toName(Class<?> type)
Deprecated.Canonical name for a type.- Parameters:
type
- A class , which may be a primitive TYPE field.- Returns:
- Canonical name.
-
toClassReference
public static String toClassReference(Class<?> clazz)
Deprecated.Return the Classpath / Classloader reference for the provided class file.Convenience method for the code
String ref = myObject.getClass().getName().replace('.','/') + ".class";
- Parameters:
clazz
- the class to reference- Returns:
- the classpath reference syntax for the class file
-
toClassReference
public static String toClassReference(String className)
Deprecated.Return the Classpath / Classloader reference for the provided class file.Convenience method for the code
String ref = myClassName.replace('.','/') + ".class";
- Parameters:
className
- the class to reference- Returns:
- the classpath reference syntax for the class file
-
valueOf
public static Object valueOf(Class<?> type, String value)
Deprecated.Convert String value to instance.- Parameters:
type
- The class of the instance, which may be a primitive TYPE field.value
- The value as a string.- Returns:
- The value as an Object.
-
valueOf
public static Object valueOf(String type, String value)
Deprecated.Convert String value to instance.- Parameters:
type
- classname or type (eg int)value
- The value as a string.- Returns:
- The value as an Object.
-
parseInt
public static int parseInt(String s, int offset, int length, int base) throws NumberFormatException
Deprecated.Parse an int from a substring. Negative numbers are not handled.- Parameters:
s
- Stringoffset
- Offset within stringlength
- Length of integer or -1 for remainder of stringbase
- base of the integer- Returns:
- the parsed integer
- Throws:
NumberFormatException
- if the string cannot be parsed
-
parseInt
public static int parseInt(byte[] b, int offset, int length, int base) throws NumberFormatException
Deprecated.Parse an int from a byte array of ascii characters. Negative numbers are not handled.- Parameters:
b
- byte arrayoffset
- Offset within stringlength
- Length of integer or -1 for remainder of stringbase
- base of the integer- Returns:
- the parsed integer
- Throws:
NumberFormatException
- if the array cannot be parsed into an integer
-
parseBytes
public static byte[] parseBytes(String s, int base)
Deprecated.
-
toString
public static String toString(byte[] bytes, int base)
Deprecated.
-
convertHexDigit
public static byte convertHexDigit(byte c)
Deprecated.- Parameters:
c
- An ASCII encoded character 0-9 a-f A-F- Returns:
- The byte value of the character 0-16.
-
convertHexDigit
public static int convertHexDigit(char c)
Deprecated.- Parameters:
c
- An ASCII encoded character 0-9 a-f A-F- Returns:
- The byte value of the character 0-16.
-
convertHexDigit
public static int convertHexDigit(int c)
Deprecated.- Parameters:
c
- An ASCII encoded character 0-9 a-f A-F- Returns:
- The byte value of the character 0-16.
-
toHex
public static void toHex(byte b, Appendable buf)
Deprecated.
-
toHex
public static void toHex(int value, Appendable buf) throws IOException
Deprecated.- Throws:
IOException
-
toHex
public static void toHex(long value, Appendable buf) throws IOException
Deprecated.- Throws:
IOException
-
toHexString
public static String toHexString(byte b)
Deprecated.
-
toHexString
public static String toHexString(byte[] b)
Deprecated.
-
toHexString
public static String toHexString(byte[] b, int offset, int length)
Deprecated.
-
fromHexString
public static byte[] fromHexString(String s)
Deprecated.
-
dump
public static void dump(Class<?> c)
Deprecated.
-
dump
public static void dump(ClassLoader cl)
Deprecated.
-
call
@Deprecated public static Object call(Class<?> oClass, String methodName, Object obj, Object[] arg) throws InvocationTargetException, NoSuchMethodException
Deprecated.
-
construct
@Deprecated public static Object construct(Class<?> klass, Object[] arguments) throws InvocationTargetException, NoSuchMethodException
Deprecated.
-
construct
@Deprecated public static Object construct(Class<?> klass, Object[] arguments, Map<String,Object> namedArgMap) throws InvocationTargetException, NoSuchMethodException
Deprecated.
-
isTrue
public static boolean isTrue(Object o)
Deprecated.- Parameters:
o
- Object to test for true- Returns:
- True if passed object is not null and is either a Boolean with value true or evaluates to a string that evaluates to true.
-
isFalse
public static boolean isFalse(Object o)
Deprecated.- Parameters:
o
- Object to test for false- Returns:
- True if passed object is not null and is either a Boolean with value false or evaluates to a string that evaluates to false.
-
getLocationOfClass
public static URI getLocationOfClass(Class<?> clazz)
Deprecated.Attempt to find the Location of a loaded Class.This can be null for primitives, void, and in-memory classes.
- Parameters:
clazz
- the loaded class to find a location for.- Returns:
- the location as a URI (this is a URI pointing to a holder of the class: a directory,
a jar file, a
jrt://
resource, etc), or null of no location available.
-
getSystemClassLoaderLocation
public static URI getSystemClassLoaderLocation(Class<?> clazz)
Deprecated.
-
getClassLoaderLocation
public static URI getClassLoaderLocation(Class<?> clazz, ClassLoader loader)
Deprecated.
-
-