Module lettuce.core

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 Details

    • GenericTypeResolver

      public GenericTypeResolver()
  • Method Details

    • getTypeVariableMap

      public static Map<TypeVariable,​Type> getTypeVariableMap​(Class<?> clazz)
      Build a mapping of TypeVariable names to concrete classes for the specified Class. 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 against
      genericIfc - 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