Package org.gradle.api.reflect
Class TypeOf<T>
java.lang.Object
org.gradle.api.reflect.TypeOf<T>
- Type Parameters:
- T- Parameterized type
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 SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionbooleanReturns the list of type arguments used in the construction of this parameterized type.TypeOf<?> Returns the component type of the array type this object represents.This returns the underlying, concrete JavaClass.Fully Qualified name.TypeOf<?> Returns the first declared lower-bound of the wildcard type expression represented by this type.TypeOf<?> Returns an object that represents the type from which this parameterized type was constructed.Simple name.TypeOf<?> Returns the first declared upper-bound of the wildcard type expression represented by this type.inthashCode()booleanisArray()Queries whether this object represents an array, generic or otherwise.final booleanisAssignableFrom(Type type) Is this type assignable from the given type?final booleanisAssignableFrom(TypeOf<?> type) Is this type assignable from the given type?booleanQueries whether this object represents a parameterized type.booleanisPublic()Queries whether the type represented by this object is public (Modifier.isPublic(int)).booleanisSimple()Queries whether this object represents a simple (non-composite) type, not an array and not a generic type.booleanQueries whether this object represents a synthetic type as defined byClass.isSynthetic().booleanQueries 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.final StringtoString()static <T> TypeOf<T> Creates an instance of TypeOf for the given Class.static <T> TypeOf<T> Creates an instance of TypeOf for the given Type.
- 
Constructor Details- 
TypeOfprotected TypeOf()
 
- 
- 
Method Details- 
typeOfCreates 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
 
- 
typeOfCreates 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
 
- 
parameterizedTypeOfpublic 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 tonew 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:
 
- 
isSimplepublic 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.
 
- 
isSyntheticpublic boolean isSynthetic()Queries whether this object represents a synthetic type as defined byClass.isSynthetic().- Returns:
- true if this object represents a synthetic type.
 
- 
isPublicpublic boolean isPublic()Queries whether the type represented by this object is public (Modifier.isPublic(int)).- See Also:
 
- 
isArraypublic boolean isArray()Queries whether this object represents an array, generic or otherwise.- Returns:
- true if this object represents an array.
- See Also:
 
- 
getComponentTypeReturns the component type of the array type this object represents.- Returns:
- null if this object does not represent an array type.
- See Also:
 
- 
isParameterizedpublic boolean isParameterized()Queries whether this object represents a parameterized type.- Returns:
- true if this object represents a parameterized type.
- See Also:
 
- 
getParameterizedTypeDefinitionReturns an object that represents the type from which this parameterized type was constructed.- See Also:
 
- 
getActualTypeArgumentsReturns the list of type arguments used in the construction of this parameterized type.- See Also:
 
- 
isWildcardpublic 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:
 
- 
getUpperBoundReturns the first declared upper-bound of the wildcard type expression represented by this type.- Returns:
- null if no upper-bound has been explicitly declared.
 
- 
getLowerBoundReturns the first declared lower-bound of the wildcard type expression represented by this type.- Returns:
- null if no lower-bound has been explicitly declared.
- Since:
- 6.0
 
- 
isAssignableFromIs 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
 
- 
isAssignableFromIs 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
 
- 
getSimpleNameSimple name.- Returns:
- this type's simple name
 
- 
getFullyQualifiedNameFully Qualified name.- Returns:
- this type's FQN
- Since:
- 7.4
 
- 
getConcreteClassThis returns the underlying, concrete Java Class.For example, a simple TypeOf<String>will be the given generic typeString.class.
 Generic types likeTypeOf<List<String>>would have the concrete type ofList.class.
 For array types likeTypeOf<String[]>, the concrete type will be an array of the component type (String[].class).- Returns:
- Underlying Java Class of this type.
- Since:
- 5.0
 
- 
toString
- 
equals
- 
hashCodepublic int hashCode()
 
-