Class TypeUtils
- Since:
- 3.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final class
GenericArrayType implementation class.private static final class
ParameterizedType implementation class.static class
WildcardType
builder.private static final class
WildcardType implementation class. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final AppendableJoiner
<Type> Ampersand sign joiner.private static final AppendableJoiner
<TypeVariable<Class<?>>> Method classToString joiner.private static final AppendableJoiner
<Object> Greater than and lesser than sign joiner.static final WildcardType
A wildcard instance matching?
. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static <T> String
anyToString
(T object) private static void
appendRecursiveTypes
(StringBuilder builder, int[] recursiveTypeIndexes, Type[] argumentTypes) private static <T> String
classToString
(Class<T> cls) static boolean
containsTypeVariables
(Type type) Tests, recursively, whether any of the type parameters associated withtype
are bound to variables.private static boolean
containsVariableTypeSameParametrizedTypeBound
(TypeVariable<?> typeVariable, ParameterizedType parameterizedType) static Map
<TypeVariable<?>, Type> determineTypeArguments
(Class<?> cls, ParameterizedType superParameterizedType) Tries to determine the type arguments of a class/interface based on a super parameterized type's type arguments.private static boolean
equals
(GenericArrayType genericArrayType, Type type) Tests whethert
equalsa
.private static boolean
equals
(ParameterizedType parameterizedType, Type type) Tests whethert
equalsp
.private static boolean
Tests whethert1
equalst2
.static boolean
Tests equality of types.private static boolean
equals
(WildcardType wildcardType, Type type) Tests whethert
equalsw
.private static Type[]
extractTypeArgumentsFrom
(Map<TypeVariable<?>, Type> mappings, TypeVariable<?>[] variables) Helper method to establish the formal parameters for a parameterized type.private static int[]
findRecursiveTypes
(ParameterizedType parameterizedType) static GenericArrayType
genericArrayType
(Type componentType) Creates a generic array type instance.private static String
genericArrayTypeToString
(GenericArrayType genericArrayType) Formats aGenericArrayType
as aString
.static Type
getArrayComponentType
(Type type) Gets the array component type oftype
.private static Type
getClosestParentType
(Class<?> cls, Class<?> superClass) Gets the closest parent type to the super class specified bysuperClass
.static Type[]
getImplicitBounds
(TypeVariable<?> typeVariable) Gets an array containing the sole type ofObject
ifTypeVariable.getBounds()
returns an empty array.static Type[]
getImplicitLowerBounds
(WildcardType wildcardType) Gets an array containing a single value ofnull
ifWildcardType.getLowerBounds()
returns an empty array.static Type[]
getImplicitUpperBounds
(WildcardType wildcardType) Gets an array containing the sole value ofObject
ifWildcardType.getUpperBounds()
returns an empty array.private static Class
<?> getRawType
(ParameterizedType parameterizedType) Transforms the passed in type to aClass
object.static Class
<?> getRawType
(Type type, Type assigningType) Gets the raw type of a Java type, given its context.private static Map
<TypeVariable<?>, Type> getTypeArguments
(Class<?> cls, Class<?> toClass, Map<TypeVariable<?>, Type> subtypeVarAssigns) Gets a map of the type arguments of a class in the context oftoClass
.static Map
<TypeVariable<?>, Type> Gets all the type arguments for this parameterized type including owner hierarchy arguments such asOuter<K, V>.Inner<T>.DeepInner<E>
.private static Map
<TypeVariable<?>, Type> getTypeArguments
(ParameterizedType parameterizedType, Class<?> toClass, Map<TypeVariable<?>, Type> subtypeVarAssigns) Gets a map of the type arguments of a parameterized type in the context oftoClass
.static Map
<TypeVariable<?>, Type> getTypeArguments
(Type type, Class<?> toClass) Gets the type arguments of a class/interface based on a subtype.private static Map
<TypeVariable<?>, Type> getTypeArguments
(Type type, Class<?> toClass, Map<TypeVariable<?>, Type> subtypeVarAssigns) Gets a map of the type arguments oftype
in the context oftoClass
.static boolean
isArrayType
(Type type) Tests whether the specified type denotes an array type.private static boolean
isAssignable
(Type type, Class<?> toClass) Tests if the subject type may be implicitly cast to the target class following the Java generics rules.private static boolean
isAssignable
(Type type, GenericArrayType toGenericArrayType, Map<TypeVariable<?>, Type> typeVarAssigns) Tests if the subject type may be implicitly cast to the target generic array type following the Java generics rules.private static boolean
isAssignable
(Type type, ParameterizedType toParameterizedType, Map<TypeVariable<?>, Type> typeVarAssigns) Tests if the subject type may be implicitly cast to the target parameterized type following the Java generics rules.static boolean
isAssignable
(Type type, Type toType) Tests if the subject type may be implicitly cast to the target type following the Java generics rules.private static boolean
isAssignable
(Type type, Type toType, Map<TypeVariable<?>, Type> typeVarAssigns) Tests if the subject type may be implicitly cast to the target type following the Java generics rules.private static boolean
isAssignable
(Type type, TypeVariable<?> toTypeVariable, Map<TypeVariable<?>, Type> typeVarAssigns) Tests if the subject type may be implicitly cast to the target type variable following the Java generics rules.private static boolean
isAssignable
(Type type, WildcardType toWildcardType, Map<TypeVariable<?>, Type> typeVarAssigns) Tests if the subject type may be implicitly cast to the target wildcard type following the Java generics rules.private static boolean
isCyclical
(Class<?> cls) Tests whether the class contains a cyclical reference in the qualified name of a class.static boolean
isInstance
(Object value, Type type) Tests if the given value can be assigned to the target type following the Java generics rules.private static <T> void
mapTypeVariablesToArguments
(Class<T> cls, ParameterizedType parameterizedType, Map<TypeVariable<?>, Type> typeVarAssigns) Maps type variables.static Type[]
normalizeUpperBounds
(Type[] bounds) Strips out the redundant upper bound types in type variable types and wildcard types (or it would with wildcard types if multiple upper bounds were allowed).static final ParameterizedType
parameterize
(Class<?> rawClass, Type... typeArguments) Creates a parameterized type instance.static final ParameterizedType
parameterize
(Class<?> rawClass, Map<TypeVariable<?>, Type> typeVariableMap) Creates a parameterized type instance.private static String
parameterizedTypeToString
(ParameterizedType parameterizedType) Formats aParameterizedType
as aString
.static final ParameterizedType
parameterizeWithOwner
(Type owner, Class<?> rawClass, Type... typeArguments) Creates a parameterized type instance.static final ParameterizedType
parameterizeWithOwner
(Type owner, Class<?> rawClass, Map<TypeVariable<?>, Type> typeVariableMap) Creates a parameterized type instance.private static Type
substituteTypeVariables
(Type type, Map<TypeVariable<?>, Type> typeVarAssigns) Finds the mapping fortype
intypeVarAssigns
.static String
toLongString
(TypeVariable<?> typeVariable) Formats aTypeVariable
including itsGenericDeclaration
.static String
Formats a given type as a Java-esque String.static boolean
typesSatisfyVariables
(Map<TypeVariable<?>, Type> typeVariableMap) Determines whether or not specified types satisfy the bounds of their mapped type variables.private static String
typeVariableToString
(TypeVariable<?> typeVariable) Formats aTypeVariable
as aString
.private static Type[]
unrollBounds
(Map<TypeVariable<?>, Type> typeArguments, Type[] bounds) Unrolls variables in a type bounds array.private static Type
unrollVariableAssignments
(TypeVariable<?> typeVariable, Map<TypeVariable<?>, Type> typeVarAssigns) Looks uptypeVariable
intypeVarAssigns
transitively, i.e.static Type
unrollVariables
(Map<TypeVariable<?>, Type> typeArguments, Type type) Gets a type representingtype
with variable assignments "unrolled."Gets aTypeUtils.WildcardTypeBuilder
.private static String
wildcardTypeToString
(WildcardType wildcardType) Formats aWildcardType
as aString
.static <T> Typed
<T> static <T> Typed
<T>
-
Field Details
-
AMP_JOINER
Ampersand sign joiner. -
CTJ_JOINER
Method classToString joiner. -
GT_JOINER
Greater than and lesser than sign joiner. -
WILDCARD_ALL
A wildcard instance matching?
.- Since:
- 3.2
-
-
Constructor Details
-
TypeUtils
Deprecated.TODO Make private in 4.0.TypeUtils
instances should NOT be constructed in standard programming. Instead, the class should be used asTypeUtils.isAssignable(cls, toClass)
.This constructor is public to permit tools that require a JavaBean instance to operate.
-
-
Method Details
-
anyToString
-
appendRecursiveTypes
private static void appendRecursiveTypes(StringBuilder builder, int[] recursiveTypeIndexes, Type[] argumentTypes) -
classToString
- Parameters:
cls
-Class
to format- Returns:
- String
-
containsTypeVariables
Tests, recursively, whether any of the type parameters associated withtype
are bound to variables.- Parameters:
type
- the type to check for type variables- Returns:
- boolean
- Since:
- 3.2
-
containsVariableTypeSameParametrizedTypeBound
private static boolean containsVariableTypeSameParametrizedTypeBound(TypeVariable<?> typeVariable, ParameterizedType parameterizedType) -
determineTypeArguments
public static Map<TypeVariable<?>,Type> determineTypeArguments(Class<?> cls, ParameterizedType superParameterizedType) Tries to determine the type arguments of a class/interface based on a super parameterized type's type arguments. This method is the inverse ofgetTypeArguments(Type, Class)
which gets a class/interface's type arguments based on a subtype. It is far more limited in determining the type arguments for the subject class's type variables in that it can only determine those parameters that map from the subjectClass
object to the supertype.Example:
TreeSet
sets its parameter as the parameter forNavigableSet
, which in turn sets the parameter ofSortedSet
, which in turn sets the parameter ofSet
, which in turn sets the parameter ofCollection
, which in turn sets the parameter ofIterable
. SinceTreeSet
's parameter maps (indirectly) toIterable
's parameter, it will be able to determine that based on the super typeIterable<? extends Map<Integer, ? extends Collection<?>>>
, the parameter ofTreeSet
is? extends Map<Integer, ? extends Collection<?>>
.- Parameters:
cls
- the class whose type parameters are to be determined, notnull
superParameterizedType
- the super type from whichcls
's type arguments are to be determined, notnull
- Returns:
- a
Map
of the type assignments that could be determined for the type variables in each type in the inheritance hierarchy fromtype
totoClass
inclusive. - Throws:
NullPointerException
- if eithercls
orsuperParameterizedType
isnull
-
equals
Tests whethert
equalsa
.- Parameters:
genericArrayType
- LHStype
- RHS- Returns:
- boolean
-
equals
Tests whethert
equalsp
.- Parameters:
parameterizedType
- LHStype
- RHS- Returns:
- boolean
-
equals
Tests equality of types.- Parameters:
type1
- the first typetype2
- the second type- Returns:
- boolean
- Since:
- 3.2
-
equals
Tests whethert1
equalst2
.- Parameters:
type1
- LHStype2
- RHS- Returns:
- boolean
-
equals
Tests whethert
equalsw
.- Parameters:
wildcardType
- LHStype
- RHS- Returns:
- boolean
-
extractTypeArgumentsFrom
private static Type[] extractTypeArgumentsFrom(Map<TypeVariable<?>, Type> mappings, TypeVariable<?>[] variables) Helper method to establish the formal parameters for a parameterized type.- Parameters:
mappings
- map containing the assignmentsvariables
- expected map keys- Returns:
- array of map values corresponding to specified keys
-
findRecursiveTypes
-
genericArrayType
Creates a generic array type instance.- Parameters:
componentType
- the type of the elements of the array. For example the component type ofboolean[]
isboolean
- Returns:
GenericArrayType
- Since:
- 3.2
-
genericArrayTypeToString
Formats aGenericArrayType
as aString
.- Parameters:
genericArrayType
-GenericArrayType
to format- Returns:
- String
-
getArrayComponentType
Gets the array component type oftype
.- Parameters:
type
- the type to be checked- Returns:
- component type or null if type is not an array type
-
getClosestParentType
Gets the closest parent type to the super class specified bysuperClass
.- Parameters:
cls
- the class in questionsuperClass
- the super class- Returns:
- the closes parent type
-
getImplicitBounds
Gets an array containing the sole type ofObject
ifTypeVariable.getBounds()
returns an empty array. Otherwise, it returns the result ofTypeVariable.getBounds()
passed intonormalizeUpperBounds(java.lang.reflect.Type[])
.- Parameters:
typeVariable
- the subject type variable, notnull
- Returns:
- a non-empty array containing the bounds of the type variable.
- Throws:
NullPointerException
- iftypeVariable
isnull
-
getImplicitLowerBounds
Gets an array containing a single value ofnull
ifWildcardType.getLowerBounds()
returns an empty array. Otherwise, it returns the result ofWildcardType.getLowerBounds()
.- Parameters:
wildcardType
- the subject wildcard type, notnull
- Returns:
- a non-empty array containing the lower bounds of the wildcard type.
- Throws:
NullPointerException
- ifwildcardType
isnull
-
getImplicitUpperBounds
Gets an array containing the sole value ofObject
ifWildcardType.getUpperBounds()
returns an empty array. Otherwise, it returns the result ofWildcardType.getUpperBounds()
passed intonormalizeUpperBounds(java.lang.reflect.Type[])
.- Parameters:
wildcardType
- the subject wildcard type, notnull
- Returns:
- a non-empty array containing the upper bounds of the wildcard type.
- Throws:
NullPointerException
- ifwildcardType
isnull
-
getRawType
Transforms the passed in type to aClass
object. Type-checking method of convenience.- Parameters:
parameterizedType
- the type to be converted- Returns:
- the corresponding
Class
object - Throws:
IllegalStateException
- if the conversion fails
-
getRawType
Gets the raw type of a Java type, given its context. Primarily for use withTypeVariable
s andGenericArrayType
s, or when you do not know the runtime type oftype
: if you know you have aClass
instance, it is already raw; if you know you have aParameterizedType
, its raw type is only a method call away.- Parameters:
type
- to resolveassigningType
- type to be resolved against- Returns:
- the resolved
Class
object ornull
if the type could not be resolved
-
getTypeArguments
private static Map<TypeVariable<?>,Type> getTypeArguments(Class<?> cls, Class<?> toClass, Map<TypeVariable<?>, Type> subtypeVarAssigns) Gets a map of the type arguments of a class in the context oftoClass
.- Parameters:
cls
- the class in questiontoClass
- the context classsubtypeVarAssigns
- a map with type variables- Returns:
- the
Map
with type arguments
-
getTypeArguments
Gets all the type arguments for this parameterized type including owner hierarchy arguments such asOuter<K, V>.Inner<T>.DeepInner<E>
. The arguments are returned in aMap
specifying the argument type for eachTypeVariable
.- Parameters:
type
- specifies the subject parameterized type from which to harvest the parameters.- Returns:
- a
Map
of the type arguments to their respective type variables.
-
getTypeArguments
private static Map<TypeVariable<?>,Type> getTypeArguments(ParameterizedType parameterizedType, Class<?> toClass, Map<TypeVariable<?>, Type> subtypeVarAssigns) Gets a map of the type arguments of a parameterized type in the context oftoClass
.- Parameters:
parameterizedType
- the parameterized typetoClass
- the classsubtypeVarAssigns
- a map with type variables- Returns:
- the
Map
with type arguments
-
getTypeArguments
Gets the type arguments of a class/interface based on a subtype. For instance, this method will determine that both of the parameters for the interfaceMap
areObject
for the subtypeProperties
even though the subtype does not directly implement theMap
interface.This method returns
null
iftype
is not assignable totoClass
. It returns an empty map if none of the classes or interfaces in its inheritance hierarchy specify any type arguments.A side effect of this method is that it also retrieves the type arguments for the classes and interfaces that are part of the hierarchy between
type
andtoClass
. So with the above example, this method will also determine that the type arguments forHashtable
are also bothObject
. In cases where the interface specified bytoClass
is (indirectly) implemented more than once (e.g. wheretoClass
specifies the interfaceIterable
andtype
specifies a parameterized type that implements bothSet
andCollection
), this method will look at the inheritance hierarchy of only one of the implementations/subclasses; the first interface encountered that isn't a subinterface to one of the others in thetype
totoClass
hierarchy.- Parameters:
type
- the type from which to determine the type parameters oftoClass
toClass
- the class whose type parameters are to be determined based on the subtypetype
- Returns:
- a
Map
of the type assignments for the type variables in each type in the inheritance hierarchy fromtype
totoClass
inclusive.
-
getTypeArguments
private static Map<TypeVariable<?>,Type> getTypeArguments(Type type, Class<?> toClass, Map<TypeVariable<?>, Type> subtypeVarAssigns) Gets a map of the type arguments oftype
in the context oftoClass
.- Parameters:
type
- the type in questiontoClass
- the classsubtypeVarAssigns
- a map with type variables- Returns:
- the
Map
with type arguments
-
isArrayType
Tests whether the specified type denotes an array type.- Parameters:
type
- the type to be checked- Returns:
true
iftype
is an array class or aGenericArrayType
.
-
isAssignable
Tests if the subject type may be implicitly cast to the target class following the Java generics rules.- Parameters:
type
- the subject type to be assigned to the target typetoClass
- the target class- Returns:
true
iftype
is assignable totoClass
.
-
isAssignable
private static boolean isAssignable(Type type, GenericArrayType toGenericArrayType, Map<TypeVariable<?>, Type> typeVarAssigns) Tests if the subject type may be implicitly cast to the target generic array type following the Java generics rules.- Parameters:
type
- the subject type to be assigned to the target typetoGenericArrayType
- the target generic array typetypeVarAssigns
- a map with type variables- Returns:
true
iftype
is assignable totoGenericArrayType
.
-
isAssignable
private static boolean isAssignable(Type type, ParameterizedType toParameterizedType, Map<TypeVariable<?>, Type> typeVarAssigns) Tests if the subject type may be implicitly cast to the target parameterized type following the Java generics rules.- Parameters:
type
- the subject type to be assigned to the target typetoParameterizedType
- the target parameterized typetypeVarAssigns
- a map with type variables- Returns:
true
iftype
is assignable totoType
.
-
isAssignable
Tests if the subject type may be implicitly cast to the target type following the Java generics rules. If both types areClass
objects, the method returns the result ofClassUtils.isAssignable(Class, Class)
.- Parameters:
type
- the subject type to be assigned to the target typetoType
- the target type- Returns:
true
iftype
is assignable totoType
.
-
isAssignable
private static boolean isAssignable(Type type, Type toType, Map<TypeVariable<?>, Type> typeVarAssigns) Tests if the subject type may be implicitly cast to the target type following the Java generics rules.- Parameters:
type
- the subject type to be assigned to the target typetoType
- the target typetypeVarAssigns
- optional map of type variable assignments- Returns:
true
iftype
is assignable totoType
.
-
isAssignable
private static boolean isAssignable(Type type, TypeVariable<?> toTypeVariable, Map<TypeVariable<?>, Type> typeVarAssigns) Tests if the subject type may be implicitly cast to the target type variable following the Java generics rules.- Parameters:
type
- the subject type to be assigned to the target typetoTypeVariable
- the target type variabletypeVarAssigns
- a map with type variables- Returns:
true
iftype
is assignable totoTypeVariable
.
-
isAssignable
private static boolean isAssignable(Type type, WildcardType toWildcardType, Map<TypeVariable<?>, Type> typeVarAssigns) Tests if the subject type may be implicitly cast to the target wildcard type following the Java generics rules.- Parameters:
type
- the subject type to be assigned to the target typetoWildcardType
- the target wildcard typetypeVarAssigns
- a map with type variables- Returns:
true
iftype
is assignable totoWildcardType
.
-
isCyclical
Tests whether the class contains a cyclical reference in the qualified name of a class. If any of the type parameters of A class is extending X class which is in scope of A class, then it forms cycle.- Parameters:
cls
- the class to test.- Returns:
- whether the class contains a cyclical reference.
-
isInstance
Tests if the given value can be assigned to the target type following the Java generics rules.- Parameters:
value
- the value to be checkedtype
- the target type- Returns:
true
ifvalue
is an instance oftype
.
-
mapTypeVariablesToArguments
private static <T> void mapTypeVariablesToArguments(Class<T> cls, ParameterizedType parameterizedType, Map<TypeVariable<?>, Type> typeVarAssigns) Maps type variables.- Type Parameters:
T
- the generic type of the class in question- Parameters:
cls
- the class in questionparameterizedType
- the parameterized typetypeVarAssigns
- the map to be filled
-
normalizeUpperBounds
Strips out the redundant upper bound types in type variable types and wildcard types (or it would with wildcard types if multiple upper bounds were allowed).Example, with the variable type declaration:
<K extends java.util.Collection<String> & java.util.List<String>>
since
List
is a subinterface ofCollection
, this method will return the bounds as if the declaration had been:<K extends java.util.List<String>>
- Parameters:
bounds
- an array of types representing the upper bounds of eitherWildcardType
orTypeVariable
, notnull
.- Returns:
- an array containing the values from
bounds
minus the redundant types. - Throws:
NullPointerException
- ifbounds
isnull
-
parameterize
public static final ParameterizedType parameterize(Class<?> rawClass, Map<TypeVariable<?>, Type> typeVariableMap) Creates a parameterized type instance.- Parameters:
rawClass
- the raw class to create a parameterized type instance fortypeVariableMap
- the map used for parameterization- Returns:
ParameterizedType
- Throws:
NullPointerException
- if eitherrawClass
ortypeVariableMap
isnull
- Since:
- 3.2
-
parameterize
Creates a parameterized type instance.- Parameters:
rawClass
- the raw class to create a parameterized type instance fortypeArguments
- the types used for parameterization- Returns:
ParameterizedType
- Throws:
NullPointerException
- ifrawClass
isnull
- Since:
- 3.2
-
parameterizedTypeToString
Formats aParameterizedType
as aString
.- Parameters:
parameterizedType
-ParameterizedType
to format- Returns:
- String
-
parameterizeWithOwner
public static final ParameterizedType parameterizeWithOwner(Type owner, Class<?> rawClass, Map<TypeVariable<?>, Type> typeVariableMap) Creates a parameterized type instance.- Parameters:
owner
- the owning typerawClass
- the raw class to create a parameterized type instance fortypeVariableMap
- the map used for parameterization- Returns:
ParameterizedType
- Throws:
NullPointerException
- if eitherrawClass
ortypeVariableMap
isnull
- Since:
- 3.2
-
parameterizeWithOwner
public static final ParameterizedType parameterizeWithOwner(Type owner, Class<?> rawClass, Type... typeArguments) Creates a parameterized type instance.- Parameters:
owner
- the owning typerawClass
- the raw class to create a parameterized type instance fortypeArguments
- the types used for parameterization- Returns:
ParameterizedType
- Throws:
NullPointerException
- ifrawClass
isnull
- Since:
- 3.2
-
substituteTypeVariables
Finds the mapping fortype
intypeVarAssigns
.- Parameters:
type
- the type to be replacedtypeVarAssigns
- the map with type variables- Returns:
- the replaced type
- Throws:
IllegalArgumentException
- if the type cannot be substituted
-
toLongString
Formats aTypeVariable
including itsGenericDeclaration
.- Parameters:
typeVariable
- the type variable to create a String representation for, notnull
- Returns:
- String
- Throws:
NullPointerException
- iftypeVariable
isnull
- Since:
- 3.2
-
toString
Formats a given type as a Java-esque String.- Parameters:
type
- the type to create a String representation for, notnull
- Returns:
- String
- Throws:
NullPointerException
- iftype
isnull
- Since:
- 3.2
-
typesSatisfyVariables
Determines whether or not specified types satisfy the bounds of their mapped type variables. When a type parameter extends another (such as<T, S extends T>
), uses another as a type parameter (such as<T, S extends Comparable>>
), or otherwise depends on another type variable to be specified, the dependencies must be included intypeVarAssigns
.- Parameters:
typeVariableMap
- specifies the potential types to be assigned to the type variables, notnull
.- Returns:
- whether or not the types can be assigned to their respective type variables.
- Throws:
NullPointerException
- iftypeVariableMap
isnull
-
typeVariableToString
Formats aTypeVariable
as aString
.- Parameters:
typeVariable
-TypeVariable
to format- Returns:
- String
-
unrollBounds
Unrolls variables in a type bounds array.- Parameters:
typeArguments
- assignmentsMap
bounds
- in which to expand variables- Returns:
bounds
with any variables reassigned
-
unrollVariableAssignments
private static Type unrollVariableAssignments(TypeVariable<?> typeVariable, Map<TypeVariable<?>, Type> typeVarAssigns) Looks uptypeVariable
intypeVarAssigns
transitively, i.e. keep looking until the value found is not a type variable.- Parameters:
typeVariable
- the type variable to look uptypeVarAssigns
- the map used for the look-up- Returns:
- Type or
null
if some variable was not in the map
-
unrollVariables
Gets a type representingtype
with variable assignments "unrolled."- Parameters:
typeArguments
- as fromgetTypeArguments(Type, Class)
type
- the type to unroll variable assignments for- Returns:
- Type
- Since:
- 3.2
-
wildcardType
Gets aTypeUtils.WildcardTypeBuilder
.- Returns:
TypeUtils.WildcardTypeBuilder
- Since:
- 3.2
-
wildcardTypeToString
Formats aWildcardType
as aString
.- Parameters:
wildcardType
-WildcardType
to format- Returns:
- String
-
wrap
- Type Parameters:
T
- generic type- Parameters:
type
- to wrap- Returns:
Typed<T>
- Since:
- 3.2
-
wrap
- Type Parameters:
T
- inferred generic type- Parameters:
type
- to wrap- Returns:
Typed<T>
- Since:
- 3.2
-