public class TypeUtils
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static java.lang.Class |
convertTypeToClass(java.lang.reflect.Type type)
Converts
type to a class. |
static java.lang.reflect.Type |
getTypeArgument(java.lang.reflect.Type type,
int i)
Returns the TypeArgument of a
Type if parameterized, else null. |
static boolean |
isArray(java.lang.Class<?> type)
Determines if the given
Type is an array. |
static boolean |
isAssignableFrom(java.lang.Class from,
java.lang.Class target)
Determines if the given
from class is assignable from the target class. |
static boolean |
isBoolean(java.lang.Class<?> type)
Determines if the given
Type is a boolean. |
static boolean |
isCharacter(java.lang.Class<?> type)
Determines if the given
Type is a character. |
static boolean |
isCompound(java.lang.Class<?> type)
Determines if the given
Type is compound (not primitive, not wrapper, not a string). |
static boolean |
isDate(java.lang.Class<?> type)
Determines if the given
Type is a date. |
static boolean |
isDecimal(java.lang.Class<?> type)
Determines if the given
Type is a decimal number. |
static boolean |
isEnum(java.lang.Class<?> type)
Determines if the given
Type is an enum. |
static boolean |
isLong(java.lang.Class<?> type)
Determines if the given
Type is a long. |
static boolean |
isNumber(java.lang.Class<?> type)
Determines if the given
Type is a number. |
static boolean |
isPrimitive(java.lang.Class<?> type)
Determines if the given
Type is a primitive (excluding void). |
static boolean |
isString(java.lang.Class<?> type)
Determines if the given
Type is a string. |
static boolean |
isWrapper(java.lang.Class<?> type)
Determines if the given
Type is a wrapper. |
public static boolean isPrimitive(java.lang.Class<?> type)
Type is a primitive (excluding void).type - an arbitrary classtrue if type is a primitive typepublic static boolean isWrapper(java.lang.Class<?> type)
Type is a wrapper.type - an arbitrary classtrue if type is a wrapper typepublic static boolean isString(java.lang.Class<?> type)
Type is a string.type - an arbitrary classtrue if type is a stringpublic static boolean isCompound(java.lang.Class<?> type)
Type is compound (not primitive, not wrapper, not a string).type - an arbitrary classtrue if type is compoundpublic static boolean isAssignableFrom(java.lang.Class from,
java.lang.Class target)
from class is assignable from the target class.from - is an arbitrary classtarget - is an arbitrary classtrue if target is assignable from frompublic static boolean isNumber(java.lang.Class<?> type)
Type is a number.type - an arbitrary classtrue if type is a numberpublic static boolean isArray(java.lang.Class<?> type)
Type is an array.type - an arbitrary classtrue if type is an arraypublic static boolean isEnum(java.lang.Class<?> type)
Type is an enum.type - an arbitrary classtrue if type is an enumpublic static boolean isDate(java.lang.Class<?> type)
Type is a date.type - an arbitrary classtrue if type is a datepublic static boolean isBoolean(java.lang.Class<?> type)
Type is a boolean.type - an arbitrary classtrue if type is a booleanpublic static boolean isCharacter(java.lang.Class<?> type)
Type is a character.type - an arbitrary classtrue if type is a characterpublic static boolean isLong(java.lang.Class<?> type)
Type is a long.type - an arbitrary classtrue if type is a longpublic static boolean isDecimal(java.lang.Class<?> type)
Type is a decimal number.type - an arbitrary classtrue if type is a longpublic static java.lang.Class convertTypeToClass(java.lang.reflect.Type type)
type to a class.type - is a TypeTypepublic static java.lang.reflect.Type getTypeArgument(java.lang.reflect.Type type,
int i)
Type if parameterized, else null.type - is a Typei - is the index of the ActualTypeArgumenti_th type parameter of the given type if parametrized, else null