public final class TypeUtil
extends java.lang.Object
Type
s and derivatives. This class is adapted heavily from the
Spring Framework, specifically the
TypeUtils
class.Type
,
GenericArrayType
,
ParameterizedType
,
WildcardType
,
Class
Modifier | Constructor and Description |
---|---|
private |
TypeUtil() |
Modifier and Type | Method and Description |
---|---|
static java.util.List<java.lang.reflect.Field> |
getAllDeclaredFields(java.lang.Class<?> cls)
Gets all declared fields for the given class (including superclasses).
|
private static java.lang.reflect.Type[] |
getEffectiveLowerBounds(java.lang.reflect.WildcardType type) |
private static java.lang.reflect.Type[] |
getEffectiveUpperBounds(java.lang.reflect.WildcardType type) |
static boolean |
isAssignable(java.lang.reflect.Type lhs,
java.lang.reflect.Type rhs)
Indicates if two
Type s are assignment compatible. |
private static boolean |
isBoundAssignable(java.lang.reflect.Type lhs,
java.lang.reflect.Type rhs) |
private static boolean |
isParameterizedAssignable(java.lang.reflect.ParameterizedType lhs,
java.lang.reflect.ParameterizedType rhs) |
private static boolean |
isWildcardAssignable(java.lang.reflect.WildcardType lhs,
java.lang.reflect.Type rhs) |
public static java.util.List<java.lang.reflect.Field> getAllDeclaredFields(java.lang.Class<?> cls)
cls
- the class to examineClass.getDeclaredFields()
public static boolean isAssignable(java.lang.reflect.Type lhs, java.lang.reflect.Type rhs)
Type
s are assignment compatible.lhs
- the left hand side to check assignability torhs
- the right hand side to check assignability fromtrue
if it is legal to assign a variable of type rhs
to a variable of type lhs
Class.isAssignableFrom(Class)
private static boolean isParameterizedAssignable(java.lang.reflect.ParameterizedType lhs, java.lang.reflect.ParameterizedType rhs)
private static boolean isWildcardAssignable(java.lang.reflect.WildcardType lhs, java.lang.reflect.Type rhs)
private static java.lang.reflect.Type[] getEffectiveUpperBounds(java.lang.reflect.WildcardType type)
private static java.lang.reflect.Type[] getEffectiveLowerBounds(java.lang.reflect.WildcardType type)
private static boolean isBoundAssignable(java.lang.reflect.Type lhs, java.lang.reflect.Type rhs)