L - the list type whose type argument will be used to create the wildcard type. Bounded to List as a reminder
that the actual type argument of the List is considered, and not the List itself.public abstract class NestedTypeReference<L extends List> extends TypeInfo
TypeReference. This class is used as follows:
TypeInfo typeInfo = new NestedTypeReference<List<?>>() { }; // TypeInfo of '?' wildcard
This class is specifically for creating wildcard types from a type declaration, and the resulting wildcard type
can be retrieved with wildcardType():
WildcardType wildcard = new NestedTypeReference<List<? extends Serializable>>() { }.wildcardType();
Use TypeReference if it is not needed to nest the type parameter in a dummy List type.
Note that wildcard types can also be created programmatically with
WildcardTypeImpl.| Constructor and Description |
|---|
NestedTypeReference()
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
protected Type |
inferTypeForNoArgsConstructor()
Called in the no-args constructor, allowing to infer the type through some other way.
|
WildcardType |
wildcardType()
Convenience method to retrieve the inner class cast to a WildcardType.
|
equals, equalTo, getAllTypeInfos, getAllTypes, getComponentType, getEnclosingType, getSafeToReadClass, getType, getTypeArgumentAsClass, getTypeArgumentInfo, hashCode, isAssignableFrom, of, of, resolve, resolveSuperclass, toClass, toString, visitAllTypespublic NestedTypeReference()
public WildcardType wildcardType()
IllegalStateException - if the wrapped type is not a wildcard typeprotected Type inferTypeForNoArgsConstructor()
TypeInfoinferTypeForNoArgsConstructor in class TypeInfoCopyright © 2023. All rights reserved.