public final class TypeResolverUtils extends Object
| Constructor and Description |
|---|
TypeResolverUtils() |
| Modifier and Type | Method and Description |
|---|---|
static Class<?> |
getComponentType(Type type) |
static Class<?> |
getComponentType(Type type,
Class<?> implClass) |
static Class<?> |
getComponentType(Type type,
Class<?> implClass,
int index)
Returns the component type of the given type.
|
static Class<?> |
getComponentType(Type type,
int index) |
static Class<?> |
getGenericSupertype(Class<?> type) |
static Class<?> |
getGenericSupertype(Class<?> type,
int index)
Returns generic supertype for given class and 0-based index.
|
static Class<?> |
getRawType(Type type)
Returns raw class for given
type. |
static Class<?> |
getRawType(Type type,
Class<?> implClass)
Returns raw class for given
type when implementation class is known
and it makes difference. |
static Type |
resolveVariable(TypeVariable<?> variable,
Class<?> implClass)
Resolves
TypeVariable with given implementation class. |
public static Class<?> getRawType(Type type)
type. Use this method with both
regular and generic types.type - - the type to converttypegetRawType(java.lang.reflect.Type, Class)public static Class<?> getRawType(Type type, Class<?> implClass)
type when implementation class is known
and it makes difference.type - - given typeimplClass - - implementation clasresolveVariable(java.lang.reflect.TypeVariable, Class)public static Type resolveVariable(TypeVariable<?> variable, Class<?> implClass)
TypeVariable with given implementation class.variable - - variableimplClass - - implementation classpublic static Class<?> getComponentType(Type type, Class<?> implClass, int index)
null if given type does not have a single
component type. For example the following types all have the
component-type MyClass:
Map<A, B> has 2 component types. If index is 0 or positive,
than it represents order of component type. If the value is negative, then it represents
component type counted from the end! Therefore, the default value of -1
always returns the last component type.type - - typeimplClass - - implementation classindex - - index of component typepublic static Class<?> getGenericSupertype(Class<?> type)
getComponentType(java.lang.reflect.Type)Copyright © 2016 jetbrick. All rights reserved.