| Modifier and Type | Field and Description |
|---|---|
| private static final WeakCache |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public static Class | |
| public static Class | |
| private static Type | Returns: a corresponding type for the generic array type, or the same type astypethe type to fix type)Replaces a |
| private static Type | Returns: a parameterized type for the class, or the same class asinClassthe base class used to resolve inClass)Replaces a |
| private static void | |
| public static Type | Returns: a resolved typethe type that supplies bindings for type variables actual, Type the type where occurrences of the variables
in formal)actual will be replaced by the corresponding bound valuesReplaces type variables of the given |
| public static Type[] | |
| public static Type | Returns: a resolved typethe base class used to resolve inClass, Type the type to resolve type)Replaces the given |
| public static Type[] | Returns: an array of resolved typesthe base class used to resolve inClass, Type[] the array of types to resolve types)Replaces all |
| TypeResolver | back to summary |
|---|---|
| public TypeResolver() | |
| erase | back to summary |
|---|---|
| public static Class Converts the given | |
| erase | back to summary |
|---|---|
| public static Class Converts all
| |
| fixGenericArray | back to summary |
|---|---|
| private static Type fixGenericArray(Type type) Replaces a | |
| getActualType | back to summary |
|---|---|
| private static Type getActualType(Class<?> inClass) Replaces a | |
| prepare | back to summary |
|---|---|
| private static void prepare(Map<Type, Type> map, Type type) Fills the map from type parameters
to types as seen by the given | |
| resolve | back to summary |
|---|---|
| public static Type resolve(Type actual, Type formal) Replaces type variables of the given A ParameterizedType is a class with type parameters, and the values of those parameters. For example, Map<K,V> is a generic class, and a corresponding ParameterizedType might look like Map<K=String,V=Integer>. Given such a ParameterizedType, this method will replace K with String, or List<K> with List<String>, or List<? super K> with List<? super String>. The Although type parameters are not inherited by subclasses in the Java language, they are effectively inherited when using reflection. For example, if you declare an interface like this...
public interface StringToIntMap extends Map<String,Integer> {}
...then StringToIntMap.class.getMethods() will show that it has methods
like put(K,V) even though StringToIntMap has no type parameters. The K
and V variables are the ones declared by Map, so
For this reason, this method replaces inherited type parameters too.
Therefore if this method is called with In the case where
public interface StringToIntListMap extends Map<String,List<Integer>> {}
public interface RawStringToIntListMap extends StringToIntListMap {}
...the V inherited from Map will show up as List<Integer> in StringToIntListMap, but as plain List in RawStringToIntListMap. | |
| resolve | back to summary |
|---|---|
| public static Type[] resolve(Type actual, Type[] formals) Replaces type variables of all formal types in the given array
with the types they stand for in the given | |
| resolveInClass | back to summary |
|---|---|
| public static Type resolveInClass(Class<?> inClass, Type type) Replaces the given Although type parameters are not inherited by subclasses in the Java language, they are effectively inherited when using reflection. For example, if you declare an interface like this...
public interface StringToIntMap extends Map<String,Integer> {}
...then StringToIntMap.class.getMethods() will show that it has methods
like put(K,V) even though StringToIntMap has no type parameters. The K
and V variables are the ones declared by Map, so
The purpose of this method is to take a Type from a possibly-inherited method and replace it with the correct Type for the inheriting class. So given parameters of K and StringToIntMap.class in the above example, this method will return String.
| |
| resolveInClass | back to summary |
|---|---|
| public static Type[] resolveInClass(Class<?> inClass, Type[] types) Replaces all
| |