org.richfaces.fragment.common

## Class TypeResolver

- java.lang.Object
- - org.richfaces.fragment.common.TypeResolver

-     public final class TypeResolver
      extends Object

  Enhanced type resolution utilities. Originally based on org.springframework.core.GenericTypeResolver.
  Author:
    Jonathan Halterman

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `TypeResolver.Unknown` An unknown type.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static void` | `disableCache()` Disables the internal caching of resolved TypeVariables.
    `static void` | `enableCache()` Enables the internal caching of resolved TypeVariables.
    `static Type` | `resolveBound(TypeVariable<?> typeVariable)` Resolves the first bound for the `typeVariable`, returning `Unknown.class` if none can be resolved.
    `static Type` | `resolveGenericType(Class<?> type, Type subType)` Returns the generic `type` using type variable information from the `subType` else `null` if the generic type cannot be resolved.
    `static <T,S extends T> Class<?>` | `resolveRawArgument(Class<T> type, Class<S> subType)` Returns the raw class representing the type argument for the `type` using type variable information from the `subType`.
    `static Class<?>` | `resolveRawArgument(Type genericType, Class<?> subType)` Returns the raw class representing the type argument for the `genericType` using type variable information from the `subType`.
    `static <T,S extends T> Class<?>[]` | `resolveRawArguments(Class<T> type, Class<S> subType)` Returns an array of raw classes representing type arguments for the `type` using type variable information from the `subType`.
    `static Class<?>[]` | `resolveRawArguments(Type genericType, Class<?> subType)` Returns an array of raw classes representing type arguments for the `genericType` using type variable information from the `subType`.
    `static Class<?>` | `resolveRawClass(Type genericType, Class<?> subType)` Resolves the raw class for the `genericType`, using the type variable information from the `subType` else `TypeResolver.Unknown` if the raw class cannot be resolved.

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

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

- - ### Method Detail

    - #### enableCache

          public static void enableCache()

      Enables the internal caching of resolved TypeVariables.

    - #### disableCache

          public static void disableCache()

      Disables the internal caching of resolved TypeVariables.

    - #### resolveRawArgument

          public static <T,S extends T> Class<?> resolveRawArgument(Class<T> type,
                                                    Class<S> subType)

      Returns the raw class representing the type argument for the `type` using type variable information from the `subType`. If no arguments can be resolved then `Unknown.class` is returned.
      Parameters:
        `type` - to resolve argument for
        `subType` - to extract type variable information from
      Returns:
        type argument for `type` else `Unknown.class` if no type arguments are declared
      Throws:
        `IllegalArgumentException` - if more or less than one type argument is resolved for the `type`

    - #### resolveRawArgument

          public static Class<?> resolveRawArgument(Type genericType,
                                    Class<?> subType)

      Returns the raw class representing the type argument for the `genericType` using type variable information from the `subType`. If `genericType` is an instance of class, then `genericType` is returned. If no arguments can be resolved then `Unknown.class` is returned.
      Parameters:
        `genericType` - to resolve argument for
        `subType` - to extract type variable information from
      Returns:
        type argument for `genericType` else `Unknown.class` if no type arguments are declared
      Throws:
        `IllegalArgumentException` - if more or less than one type argument is resolved for the `genericType`

    - #### resolveRawArguments

          public static <T,S extends T> Class<?>[] resolveRawArguments(Class<T> type,
                                                       Class<S> subType)

      Returns an array of raw classes representing type arguments for the `type` using type variable information from the `subType`. Arguments for `type` that cannot be resolved are returned as `Unknown.class`. If no arguments can be resolved then `null` is returned.
      Parameters:
        `type` - to resolve arguments for
        `subType` - to extract type variable information from
      Returns:
        array of raw classes representing type arguments for the `type` else `null` if no type arguments are declared

    - #### resolveRawArguments

          public static Class<?>[] resolveRawArguments(Type genericType,
                                       Class<?> subType)

      Returns an array of raw classes representing type arguments for the `genericType` using type variable information from the `subType`. Arguments for `genericType` that cannot be resolved are returned as `Unknown.class`. If no arguments can be resolved then `null` is returned.
      Parameters:
        `genericType` - to resolve arguments for
        `subType` - to extract type variable information from
      Returns:
        array of raw classes representing type arguments for the `genericType` else `null` if no type arguments are declared

    - #### resolveGenericType

          public static Type resolveGenericType(Class<?> type,
                                Type subType)

      Returns the generic `type` using type variable information from the `subType` else `null` if the generic type cannot be resolved.
      Parameters:
        `type` - to resolve generic type for
        `subType` - to extract type variable information from
      Returns:
        generic `type` else `null` if it cannot be resolved

    - #### resolveRawClass

          public static Class<?> resolveRawClass(Type genericType,
                                 Class<?> subType)

      Resolves the raw class for the `genericType`, using the type variable information from the `subType` else `TypeResolver.Unknown` if the raw class cannot be resolved.
      Parameters:
        `type` - to resolve raw class for
        `subType` - to extract type variable information from
      Returns:
        raw class for the `genericType` else `TypeResolver.Unknown` if it cannot be resolved

    - #### resolveBound

          public static Type resolveBound(TypeVariable<?> typeVariable)

      Resolves the first bound for the `typeVariable`, returning `Unknown.class` if none can be resolved.

Copyright © 2014 JBoss by Red Hat. All Rights Reserved.