public static interface TypeDescription.Generic extends TypeDefinition, AnnotationSource
Represents a generic type of the Java programming language. A non-generic TypeDescription
is considered to be
a specialization of a generic type.
Note that annotations that are declared on an annotated type refer to any type annotations that are declared by this
generic type. For reading annotations of the erasure type, TypeDefinition.asErasure()
must be called before.
Modifier and Type | Interface and Description |
---|---|
static class |
TypeDescription.Generic.AbstractBase
An abstract base implementation of a generic type description.
|
static interface |
TypeDescription.Generic.AnnotationReader
An annotation reader is responsible for lazily evaluating type annotations if this language
feature is available on the current JVM.
|
static class |
TypeDescription.Generic.Builder
A builder for creating describing a generic type as a
TypeDescription.Generic . |
static class |
TypeDescription.Generic.LazyProjection
A lazy projection of a generic type.
|
static class |
TypeDescription.Generic.LazyProxy
A lazy proxy for representing a
TypeDescription.Generic for a loaded type. |
static class |
TypeDescription.Generic.OfGenericArray
A base implementation of a generic type description that represents a potentially generic array.
|
static class |
TypeDescription.Generic.OfNonGenericType
A raw type representation of a non-generic type.
|
static class |
TypeDescription.Generic.OfParameterizedType
A base implementation of a generic type description that represents a parameterized type.
|
static class |
TypeDescription.Generic.OfTypeVariable
A base implementation of a generic type description that represents a type variable.
|
static class |
TypeDescription.Generic.OfWildcardType
A base implementation of a generic type description that represents a wildcard type.
|
static interface |
TypeDescription.Generic.Visitor<T>
A visitor that can be applied to a
TypeDescription.Generic for differentiating on the sort of the visited type. |
TypeDefinition.Sort, TypeDefinition.SuperClassIterator
NamedElement.WithDescriptor, NamedElement.WithGenericName, NamedElement.WithOptionalName, NamedElement.WithRuntimeName
ModifierReviewable.ForFieldDescription, ModifierReviewable.ForMethodDescription, ModifierReviewable.ForParameterDescription, ModifierReviewable.ForTypeDefinition, ModifierReviewable.OfAbstraction, ModifierReviewable.OfByteCodeElement, ModifierReviewable.OfEnumeration
AnnotationSource.Empty, AnnotationSource.Explicit
Modifier and Type | Field and Description |
---|---|
static TypeDescription.Generic |
ANNOTATION
Deprecated.
|
static TypeDescription.Generic |
CLASS
Deprecated.
|
static TypeDescription.Generic |
OBJECT
Deprecated.
|
static TypeDescription.Generic |
UNDEFINED
Represents any undefined property representing a generic type description that is instead represented as
null in order
to resemble the Java reflection API which returns null and is intuitive to many Java developers. |
static TypeDescription.Generic |
VOID
Deprecated.
|
RAW_TYPES_PROPERTY
EMPTY_NAME, NO_NAME
EMPTY_MASK
Modifier and Type | Method and Description |
---|---|
<T> T |
accept(TypeDescription.Generic.Visitor<T> visitor)
Applies a visitor to this generic type description.
|
TypeDescription.Generic |
asRawType()
Returns this type as a raw type.
|
TypeDescription.Generic |
findBindingOf(TypeDescription.Generic typeVariable)
Returns the parameter binding of the supplied type variable.
|
TypeDescription.Generic |
getComponentType()
Returns the component type of this type.
|
FieldList<FieldDescription.InGenericShape> |
getDeclaredFields()
Returns the fields that this type declares.
|
MethodList<MethodDescription.InGenericShape> |
getDeclaredMethods()
Returns the methods that this type declares.
|
TypeList.Generic |
getLowerBounds()
Returns the lower bounds of this type.
|
TypeDescription.Generic |
getOwnerType()
Returns the owner type of this type.
|
RecordComponentList<RecordComponentDescription.InGenericShape> |
getRecordComponents()
Returns the list of record components that are declared by this type.
|
String |
getSymbol()
Returns the symbol of this type variable.
|
TypeList.Generic |
getTypeArguments()
Returns the type arguments of this type.
|
TypeVariableSource |
getTypeVariableSource()
Returns the source of this type variable.
|
TypeList.Generic |
getUpperBounds()
Returns the upper bounds of this type.
|
asErasure, asGenericType, getInterfaces, getSort, getStackSize, getSuperClass, getTypeName, isArray, isPrimitive, isRecord, represents
getActualName
getTypeManifestation, isAnnotation, isInterface
isAbstract
getEnumerationState, isEnum
getOwnership, getVisibility, isDeprecated, isPackagePrivate, isPrivate, isProtected, isPublic, isStatic
getModifiers, getSyntheticState, isFinal, isSynthetic
forEach, iterator, spliterator
getDeclaredAnnotations
@Deprecated static final TypeDescription.Generic OBJECT
TypeDescription.Generic.OfNonGenericType.ForLoadedType.of(Class)
instead.Object
type.@Deprecated static final TypeDescription.Generic CLASS
TypeDescription.Generic.OfNonGenericType.ForLoadedType.of(Class)
instead.Class
non-type.@Deprecated static final TypeDescription.Generic VOID
TypeDescription.Generic.OfNonGenericType.ForLoadedType.of(Class)
instead.void
non-type.@Deprecated static final TypeDescription.Generic ANNOTATION
TypeDescription.Generic.OfNonGenericType.ForLoadedType.of(Class)
instead.JAnnotation
type.@AlwaysNull static final TypeDescription.Generic UNDEFINED
null
in order
to resemble the Java reflection API which returns null
and is intuitive to many Java developers.TypeDescription.Generic asRawType()
asErasure().asGenericType()
.TypeList.Generic getUpperBounds()
Returns the upper bounds of this type. Any type with a well-defined upper bound is bound by at least one type. If no such
type is defined, the bound is implicitly Object
.
Only non-symbolic type variables (TypeDefinition.Sort.VARIABLE
, and wildcard types
(TypeDefinition.Sort.WILDCARD
) have well-defined upper bounds. For other
types, an IllegalStateException
is thrown.
TypeList.Generic getLowerBounds()
Returns the lower bounds of this type.
Only wildcard types (Sort#WILDCARD
) define a lower bound. For other
types, an IllegalStateException
is thrown.
TypeList.Generic getTypeArguments()
Returns the type arguments of this type.
Parameters are only well-defined for parameterized types (Sort#PARAMETERIZED
).
For all other types, this method throws an IllegalStateException
.
@MaybeNull TypeDescription.Generic getOwnerType()
Returns the owner type of this type. A type's owner type describes a nested type's declaring type.
If it exists, the returned type can be a non-generic or parameterized type. If a class has no
declaring type, null
is returned.
An owner type is only well-defined for parameterized types (Sort#PARAMETERIZED
),
for non-generic types (Sort#NON_GENERIC
) and for generic arrays (Sort#GENERIC_ARRAY
).
For all other types, this method throws an IllegalStateException
.
null
if no owner type exists.@MaybeNull TypeDescription.Generic findBindingOf(TypeDescription.Generic typeVariable)
Returns the parameter binding of the supplied type variable.
This method must only be called for parameterized types (Sort#PARAMETERIZED
). For all other types,
this method throws an IllegalStateException
.
typeVariable
- The type variable for which a value should be located.null
if the type variable
is not bound by this parameterized type.TypeVariableSource getTypeVariableSource()
Sort#VARIABLE
. For other types, this method
throws an IllegalStateException
.String getSymbol()
Sort#VARIABLE
, Sort#VARIABLE_SYMBOLIC
). For other types, this method
throws an IllegalStateException
.@MaybeNull TypeDescription.Generic getComponentType()
Returns the component type of this type.
Only non-generic types (TypeDescription.Generic.Sort#NON_GENERIC
) and generic array types
TypeDescription.Generic.Sort#GENERIC_ARRAY
) define a component type. For other
types, an IllegalStateException
is thrown.
getComponentType
in interface TypeDefinition
null
if this type does not represent an array type.FieldList<FieldDescription.InGenericShape> getDeclaredFields()
TypeDefinition.Sort.NON_GENERIC
),
parameterized types (TypeDefinition.Sort.PARAMETERIZED
) or generic array types (TypeDefinition.Sort.GENERIC_ARRAY
) types. Generic array
types never define fields and the returned list is always empty for such types.getDeclaredFields
in interface TypeDefinition
TypeDefinition.Sort.NON_GENERIC
),
parameterized types (TypeDefinition.Sort.PARAMETERIZED
) or generic array types (TypeDefinition.Sort.GENERIC_ARRAY
) types. Generic array
types never define methods and the returned list is always empty for such types.MethodList<MethodDescription.InGenericShape> getDeclaredMethods()
getDeclaredMethods
in interface TypeDefinition
RecordComponentList<RecordComponentDescription.InGenericShape> getRecordComponents()
getRecordComponents
in interface TypeDefinition
<T> T accept(TypeDescription.Generic.Visitor<T> visitor)
T
- The value that this visitor yields.visitor
- The visitor to apply.Copyright © 2014–2023. All rights reserved.