public class Generics extends Object
| Constructor and Description |
|---|
Generics() |
| Modifier and Type | Method and Description |
|---|---|
static Type |
addWildcardParameters(Class<?> clazz)
Returns a type representing the class, with all type parameters the
unbound wildcard ("?").
|
static Type |
capture(Type type)
Applies capture conversion to the given type.
|
static Class<?> |
erase(Type type)
Returns the erasure of the given type.
|
static Type |
getArrayComponentType(Type type)
If type is an array type, returns the type of the component of the array.
|
static Type[] |
getExactDirectSuperTypes(Type type)
Returns the direct supertypes of the given type.
|
static Type |
getExactFieldType(Field f,
Type type)
Returns the exact type of the given field in the given type.
|
static Type |
getExactReturnType(Method m,
Type type)
Returns the exact return type of the given method in the given type.
|
static Type |
getExactSuperType(Type type,
Class<?> searchClass)
With type a supertype of searchClass, returns the exact supertype of the
given class, including type parameters.
|
static String |
getTypeName(Type type)
Returns the display name of a Type.
|
static Type |
getTypeParameter(Type type,
TypeVariable<? extends Class<?>> variable)
Gets the type parameter for a given type that is the value for a given
type variable.
|
static boolean |
isSuperType(Type superType,
Type subType)
Checks if the capture of subType is a subtype of superType
|
public static Type addWildcardParameters(Class<?> clazz)
public static Type getExactSuperType(Type type, Class<?> searchClass)
ParameterizedType representing Collection<String>.
Class if type if it is a raw
type, or has no type parametersParameterizedType if the type does
have parametersGenericArrayType if
searchClass is an array type, and the actual type has type
parameterspublic static Type getTypeParameter(Type type, TypeVariable<? extends Class<?>> variable)
type - The type to inspect.variable - The type variable to find the value for.public static boolean isSuperType(Type superType, Type subType)
public static Type getArrayComponentType(Type type)
public static Type[] getExactDirectSuperTypes(Type type)
public static Type getExactReturnType(Method m, Type type)
public static Type getExactFieldType(Field f, Type type)
Copyright © 2015. All Rights Reserved.