Package io.lettuce.core.dynamic.support
Class GenericTypeResolver
- java.lang.Object
-
- io.lettuce.core.dynamic.support.GenericTypeResolver
-
public abstract class GenericTypeResolver extends Object
Helper class for resolving generic types against type variables.Mainly intended for usage within the framework, resolving method parameter types even when they are declared generically.
-
-
Constructor Summary
Constructors Constructor Description GenericTypeResolver()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Map<TypeVariable,Type>
getTypeVariableMap(Class<?> clazz)
static Class<?>[]
resolveTypeArguments(Class<?> clazz, Class<?> genericIfc)
Resolve the type arguments of the given generic interface against the given target class which is assumed to implement the generic interface and possibly declare concrete types for its type variables.
-
-
-
Method Detail
-
getTypeVariableMap
public static Map<TypeVariable,Type> getTypeVariableMap(Class<?> clazz)
Build a mapping ofTypeVariable names
toconcrete classes
for the specifiedClass
. Searches all super types, enclosing types and interfaces.
-
resolveTypeArguments
public static Class<?>[] resolveTypeArguments(Class<?> clazz, Class<?> genericIfc)
Resolve the type arguments of the given generic interface against the given target class which is assumed to implement the generic interface and possibly declare concrete types for its type variables.- Parameters:
clazz
- the target class to check againstgenericIfc
- the generic interface or superclass to resolve the type argument from- Returns:
- the resolved type of each argument, with the array size matching the number of actual type arguments, or
null
if not resolvable
-
-