org.gradle.api.reflect

## Class TypeOf<T>

- java.lang.Object
- - org.gradle.api.reflect.TypeOf<T>

- Type Parameters:
    `T` - Parameterized type

      @Incubating
      public abstract class TypeOf<T>
      extends Object

  Provides a way to preserve high-fidelity `Type` information on generic types. Capture a generic type with an anonymous subclass. For example:

         new TypeOf<NamedDomainObjectContainer<ArtifactRepository>>() {}

  Since:
    3.5

- - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `TypeOf()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `equals(Object o)`
    `List<TypeOf<?>>` | `getActualTypeArguments()` Returns the list of type arguments used in the construction of this parameterized type.
    `TypeOf<?>` | `getComponentType()` Returns the component type of the array type this object represents.
    `TypeOf<?>` | `getParameterizedTypeDefinition()` Returns an object that represents the type from which this parameterized type was constructed.
    `String` | `getSimpleName()` Simple name.
    `TypeOf<?>` | `getUpperBound()` Returns the first declared upper-bound of the wildcard type expression represented by this type.
    `int` | `hashCode()`
    `boolean` | `isArray()` Queries whether this object represents an array, generic or otherwise.
    `boolean` | `isAssignableFrom(Type type)` Is this type assignable from the given type?
    `boolean` | `isAssignableFrom(TypeOf<?> type)` Is this type assignable from the given type?
    `boolean` | `isParameterized()` Queries whether this object represents a parameterized type.
    `boolean` | `isPublic()` Queries whether the type represented by this object is public (`Modifier.isPublic(int)`).
    `boolean` | `isSimple()` Queries whether this object represents a simple (non-composite) type, not an array and not a generic type.
    `boolean` | `isSynthetic()` Queries whether this object represents a synthetic type as defined by `Class.isSynthetic()`.
    `boolean` | `isWildcard()` Queries whether this object represents a wildcard type expression, such as `?`, `? extends Number`, or `? super Integer`.
    `static TypeOf<?>` | `parameterizedTypeOf(TypeOf<?> parameterizedType, TypeOf<?>... typeArguments)` Constructs a new parameterized type from a given parameterized type definition and an array of type arguments.
    `String` | `toString()`
    `static <T> TypeOf<T>` | `typeOf(Class<T> type)` Creates an instance of TypeOf for the given Class.
    `static <T> TypeOf<T>` | `typeOf(Type type)` Creates an instance of TypeOf for the given Type.

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

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### TypeOf

          protected TypeOf()

  - ### Method Detail

    - #### typeOf

          public static <T> TypeOf<T> typeOf(Class<T> type)

      Creates an instance of TypeOf for the given Class.
      Type Parameters:
        `T` - the parameterized type of the given Class
      Parameters:
        `type` - the Class
      Returns:
        the TypeOf that captures the generic type of the given Class

    - #### typeOf

          public static <T> TypeOf<T> typeOf(Type type)

      Creates an instance of TypeOf for the given Type.
      Type Parameters:
        `T` - the parameterized type of the given Type
      Parameters:
        `type` - the Type
      Returns:
        the TypeOf that captures the generic type of the given Type

    - #### parameterizedTypeOf

          public static TypeOf<?> parameterizedTypeOf(TypeOf<?> parameterizedType,
                                                      TypeOf<?>... typeArguments)

      Constructs a new parameterized type from a given parameterized type definition and an array of type arguments. For example, `parameterizedTypeOf(new TypeOf<List<?>>() {}, new TypeOf<String>() {})` is equivalent to `new TypeOf<List<String>>() {}`, except both the parameterized type definition and type arguments can be dynamically computed.
      Parameters:
        `parameterizedType` - the parameterized type from which to construct the new parameterized type
        `typeArguments` - the arguments with which to construct the new parameterized type
      See Also:
        `isParameterized()`

    - #### isSimple

          public boolean isSimple()

      Queries whether this object represents a simple (non-composite) type, not an array and not a generic type.
      Returns:
        true if this object represents a simple type.

    - #### isSynthetic

          public boolean isSynthetic()

      Queries whether this object represents a synthetic type as defined by `Class.isSynthetic()`.
      Returns:
        true if this object represents a synthetic type.

    - #### isPublic

          public boolean isPublic()

      Queries whether the type represented by this object is public (`Modifier.isPublic(int)`).
      See Also:
        `Modifier.isPublic(int)`, `Class.getModifiers()`

    - #### isArray

          public boolean isArray()

      Queries whether this object represents an array, generic or otherwise.
      Returns:
        true if this object represents an array.
      See Also:
        `getComponentType()`

    - #### getComponentType

          @Nullable
          public TypeOf<?> getComponentType()

      Returns the component type of the array type this object represents.
      Returns:
        null if this object does not represent an array type.
      See Also:
        `isArray()`

    - #### isParameterized

          public boolean isParameterized()

      Queries whether this object represents a parameterized type.
      Returns:
        true if this object represents a parameterized type.
      See Also:
        `getParameterizedTypeDefinition()`, `getActualTypeArguments()`

    - #### getParameterizedTypeDefinition

          public TypeOf<?> getParameterizedTypeDefinition()

      Returns an object that represents the type from which this parameterized type was constructed.
      See Also:
        `isParameterized()`

    - #### getActualTypeArguments

          public List<TypeOf<?>> getActualTypeArguments()

      Returns the list of type arguments used in the construction of this parameterized type.
      See Also:
        `isParameterized()`

    - #### isWildcard

          public boolean isWildcard()

      Queries whether this object represents a wildcard type expression, such as `?`, `? extends Number`, or `? super Integer`.
      Returns:
        true if this object represents a wildcard type expression.
      See Also:
        `getUpperBound()`

    - #### getUpperBound

          @Nullable
          public TypeOf<?> getUpperBound()

      Returns the first declared upper-bound of the wildcard type expression represented by this type.
      Returns:
        null if no upper-bound has been explicitly declared.

    - #### isAssignableFrom

          public final boolean isAssignableFrom(TypeOf<?> type)

      Is this type assignable from the given type?
      Parameters:
        `type` - the given type
      Returns:
        true if this type is assignable from the given type, false otherwise

    - #### isAssignableFrom

          public final boolean isAssignableFrom(Type type)

      Is this type assignable from the given type?
      Parameters:
        `type` - the given type
      Returns:
        true if this type is assignable from the given type, false otherwise

    - #### getSimpleName

          public String getSimpleName()

      Simple name.
      Returns:
        this type's simple name

    - #### toString

          public final String toString()

      Overrides:
        `toString` in class `Object`

    - #### equals

          public boolean equals(Object o)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`