org.keycloak.common.util.reflections

## Class Types

- java.lang.Object
- - org.keycloak.common.util.reflections.Types

-     public class Types
      extends Object

  Utility class for Types

- - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static Class<?>` | `boxedClass(Class<?> type)`
    `static Type` | `boxedType(Type type)` Gets the boxed type of a class
    `static Type[]` | `findClassParameterizedTypes(Class<?> root, ParameterizedType rootType, Class<?> searchedForClass)`
    `static Type[]` | `findInterfaceParameterizedTypes(Class<?> root, ParameterizedType rootType, Class<?> searchedForInterface)`
    `static Type[]` | `findParameterizedTypes(Class<?> root, Class<?> searchedFor)` Search for the given interface or class within the root's class/interface hierarchy.
    `static Type[]` | `getActualTypeArgumentsOfAnInterface(Class<?> classToSearch, Class<?> interfaceToFind)` Given a class and an interfaces, go through the class hierarchy to find the interface and return its type arguments.
    `static Class` | `getArgumentType(ParameterizedType pType, int index)` Gets the index-th type argument.
    `static Class` | `getCollectionBaseType(Class type, Type genericType)`
    `static Method` | `getImplementingMethod(Class clazz, Method intfMethod)` Given a method and a root class, find the actual method declared in the root that implements the method.
    `static Class` | `getMapKeyType(Type genericType)`
    `static Class` | `getMapValueType(Type genericType)`
    `static Class<?>` | `getRawType(Type type)`
    `static Class<?>` | `getRawTypeNoException(Type type)`
    `static Class` | `getTemplateParameterOfInterface(Class base, Class desiredInterface)`
    `static Class<?>` | `getTypeArgument(Type genericType)` Returns the type argument from a parameterized type
    `static boolean` | `isA(Class clazz, ParameterizedType pType)` Is the genericType of a certain class?
    `static boolean` | `isCompatible(Method method, Method intfMethod)` See if the two methods are compatible, that is they have the same relative signature
    `static Type` | `resolveTypeVariable(Class<?> root, TypeVariable<?> typeVariable)` Finds an actual value of a type variable.
    `static Type` | `resolveTypeVariables(Class<?> root, Type type)`
    `static <T> boolean` | `supports(Class<T> type, Object object, Class<?> fromInterface)` Grabs the parameterized type of fromInterface that object implements and sees if it is assignable from type.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### boxedType

          public static Type boxedType(Type type)

      Gets the boxed type of a class
      Parameters:
        `type` - The type
      Returns:
        The boxed type

    - #### boxedClass

          public static Class<?> boxedClass(Class<?> type)

    - #### isA

          public static boolean isA(Class clazz,
                                    ParameterizedType pType)

      Is the genericType of a certain class?

    - #### getArgumentType

          public static Class getArgumentType(ParameterizedType pType,
                                              int index)

      Gets the index-th type argument.

    - #### getTemplateParameterOfInterface

          public static Class getTemplateParameterOfInterface(Class base,
                                                              Class desiredInterface)

    - #### isCompatible

          public static boolean isCompatible(Method method,
                                             Method intfMethod)

      See if the two methods are compatible, that is they have the same relative signature
      Parameters:
        `method` -
        `intfMethod` -
      Returns:

    - #### getImplementingMethod

          public static Method getImplementingMethod(Class clazz,
                                                     Method intfMethod)

      Given a method and a root class, find the actual method declared in the root that implements the method.
      Parameters:
        `clazz` -
        `intfMethod` -
      Returns:

    - #### getRawType

          public static Class<?> getRawType(Type type)

    - #### getRawTypeNoException

          public static Class<?> getRawTypeNoException(Type type)

    - #### getTypeArgument

          public static Class<?> getTypeArgument(Type genericType)

      Returns the type argument from a parameterized type
      Parameters:
        `genericType` -
      Returns:
        null if there is no type parameter

    - #### getCollectionBaseType

          public static Class getCollectionBaseType(Class type,
                                                    Type genericType)

    - #### getMapKeyType

          public static Class getMapKeyType(Type genericType)

    - #### getMapValueType

          public static Class getMapValueType(Type genericType)

    - #### resolveTypeVariables

          public static Type resolveTypeVariables(Class<?> root,
                                                  Type type)

    - #### resolveTypeVariable

          public static Type resolveTypeVariable(Class<?> root,
                                                 TypeVariable<?> typeVariable)

      Finds an actual value of a type variable. The method looks in a class hierarchy for a class defining the variable and returns the value if present.
      Parameters:
        `root` -
        `typeVariable` -
      Returns:
        actual type of the type variable

    - #### getActualTypeArgumentsOfAnInterface

          public static Type[] getActualTypeArgumentsOfAnInterface(Class<?> classToSearch,
                                                                   Class<?> interfaceToFind)

      Given a class and an interfaces, go through the class hierarchy to find the interface and return its type arguments.
      Parameters:
        `classToSearch` -
        `interfaceToFind` -
      Returns:
        type arguments of the interface

    - #### findParameterizedTypes

          public static Type[] findParameterizedTypes(Class<?> root,
                                                      Class<?> searchedFor)

      Search for the given interface or class within the root's class/interface hierarchy. If the searched for class/interface is a generic return an array of real types that fill it out.
      Parameters:
        `root` -
        `searchedFor` -
      Returns:

    - #### findClassParameterizedTypes

          public static Type[] findClassParameterizedTypes(Class<?> root,
                                                           ParameterizedType rootType,
                                                           Class<?> searchedForClass)

    - #### findInterfaceParameterizedTypes

          public static Type[] findInterfaceParameterizedTypes(Class<?> root,
                                                               ParameterizedType rootType,
                                                               Class<?> searchedForInterface)

    - #### supports

          public static <T> boolean supports(Class<T> type,
                                             Object object,
                                             Class<?> fromInterface)

      Grabs the parameterized type of fromInterface that object implements and sees if it is assignable from type.
      Type Parameters:
        `T` -
      Parameters:
        `type` -
        `object` -
        `fromInterface` -
      Returns:

Copyright © 2020 JBoss by Red Hat. All rights reserved.