Interface TypeDescription.Generic
-
- All Superinterfaces:
AnnotationSource,java.lang.Iterable<TypeDefinition>,ModifierReviewable,ModifierReviewable.ForTypeDefinition,ModifierReviewable.OfAbstraction,ModifierReviewable.OfByteCodeElement,ModifierReviewable.OfEnumeration,NamedElement,TypeDefinition
- All Known Implementing Classes:
TypeDescription.Generic.AbstractBase,TypeDescription.Generic.LazyProjection,TypeDescription.Generic.LazyProjection.ForLoadedFieldType,TypeDescription.Generic.LazyProjection.ForLoadedReturnType,TypeDescription.Generic.LazyProjection.ForLoadedSuperClass,TypeDescription.Generic.LazyProjection.OfConstructorParameter,TypeDescription.Generic.LazyProjection.OfMethodParameter,TypeDescription.Generic.LazyProjection.OfRecordComponent,TypeDescription.Generic.LazyProjection.WithEagerNavigation,TypeDescription.Generic.LazyProjection.WithEagerNavigation.OfAnnotatedElement,TypeDescription.Generic.LazyProjection.WithLazyNavigation,TypeDescription.Generic.LazyProjection.WithLazyNavigation.LazyInterfaceType,TypeDescription.Generic.LazyProjection.WithLazyNavigation.LazySuperClass,TypeDescription.Generic.LazyProjection.WithLazyNavigation.OfAnnotatedElement,TypeDescription.Generic.LazyProjection.WithResolvedErasure,TypeDescription.Generic.OfGenericArray,TypeDescription.Generic.OfGenericArray.ForLoadedType,TypeDescription.Generic.OfGenericArray.Latent,TypeDescription.Generic.OfNonGenericType,TypeDescription.Generic.OfNonGenericType.ForErasure,TypeDescription.Generic.OfNonGenericType.ForLoadedType,TypeDescription.Generic.OfNonGenericType.ForReifiedErasure,TypeDescription.Generic.OfNonGenericType.Latent,TypeDescription.Generic.OfParameterizedType,TypeDescription.Generic.OfParameterizedType.ForGenerifiedErasure,TypeDescription.Generic.OfParameterizedType.ForLoadedType,TypeDescription.Generic.OfParameterizedType.ForReifiedType,TypeDescription.Generic.OfParameterizedType.Latent,TypeDescription.Generic.OfTypeVariable,TypeDescription.Generic.OfTypeVariable.ForLoadedType,TypeDescription.Generic.OfTypeVariable.Symbolic,TypeDescription.Generic.OfTypeVariable.WithAnnotationOverlay,TypeDescription.Generic.OfWildcardType,TypeDescription.Generic.OfWildcardType.ForLoadedType,TypeDescription.Generic.OfWildcardType.Latent,TypeDescription.Generic.Visitor.AnnotationStripper.NonAnnotatedTypeVariable,TypeDescription.Generic.Visitor.Substitutor.ForTypeVariableBinding.RetainedMethodTypeVariable,TypeDescription.SuperTypeLoading.ClassLoadingTypeProjection,TypeList.Generic.ForDetachedTypes.OfTypeVariables.AttachedTypeVariable,TypeList.Generic.OfConstructorExceptionTypes.TypeProjection,TypeList.Generic.OfLoadedInterfaceTypes.TypeProjection,TypeList.Generic.OfMethodExceptionTypes.TypeProjection,TypePool.Default.LazyTypeDescription.GenericTypeToken.ForGenericArray.LazyGenericArray,TypePool.Default.LazyTypeDescription.GenericTypeToken.ForLowerBoundWildcard.LazyLowerBoundWildcard,TypePool.Default.LazyTypeDescription.GenericTypeToken.ForParameterizedType.LazyParameterizedType,TypePool.Default.LazyTypeDescription.GenericTypeToken.ForParameterizedType.Nested.LazyParameterizedType,TypePool.Default.LazyTypeDescription.GenericTypeToken.ForPrimitiveType.LazyPrimitiveType,TypePool.Default.LazyTypeDescription.GenericTypeToken.ForTypeVariable.AnnotatedTypeVariable,TypePool.Default.LazyTypeDescription.GenericTypeToken.ForTypeVariable.Formal.LazyTypeVariable,TypePool.Default.LazyTypeDescription.GenericTypeToken.ForTypeVariable.UnresolvedTypeVariable,TypePool.Default.LazyTypeDescription.GenericTypeToken.ForUnboundWildcard.LazyUnboundWildcard,TypePool.Default.LazyTypeDescription.GenericTypeToken.ForUpperBoundWildcard.LazyUpperBoundWildcard,TypePool.Default.LazyTypeDescription.GenericTypeToken.Resolution.Raw.RawAnnotatedType,TypePool.Default.LazyTypeDescription.LazyMethodDescription.LazyNonGenericReceiverType,TypePool.Default.LazyTypeDescription.LazyMethodDescription.LazyParameterizedReceiverType,TypePool.Default.LazyTypeDescription.LazyMethodDescription.LazyParameterizedReceiverType.TypeArgumentList.AnnotatedTypeVariable,TypePool.Default.LazyTypeDescription.TokenizedGenericType,TypePool.Default.LazyTypeDescription.TokenizedGenericType.Malformed
- Enclosing interface:
- TypeDescription
public static interface TypeDescription.Generic extends TypeDefinition, AnnotationSource
Represents a generic type of the Java programming language. A non-generic
TypeDescriptionis 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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classTypeDescription.Generic.AbstractBaseAn abstract base implementation of a generic type description.static interfaceTypeDescription.Generic.AnnotationReaderAn annotation reader is responsible for lazily evaluating type annotations if this language feature is available on the current JVM.static classTypeDescription.Generic.BuilderA builder for creating describing a generic type as aTypeDescription.Generic.static classTypeDescription.Generic.LazyProjectionA lazy projection of a generic type.static classTypeDescription.Generic.OfGenericArrayA base implementation of a generic type description that represents a potentially generic array.static classTypeDescription.Generic.OfNonGenericTypeA raw type representation of a non-generic type.static classTypeDescription.Generic.OfParameterizedTypeA base implementation of a generic type description that represents a parameterized type.static classTypeDescription.Generic.OfTypeVariableA base implementation of a generic type description that represents a type variable.static classTypeDescription.Generic.OfWildcardTypeA base implementation of a generic type description that represents a wildcard type.static interfaceTypeDescription.Generic.Visitor<T>A visitor that can be applied to aTypeDescription.Genericfor differentiating on the sort of the visited type.-
Nested classes/interfaces inherited from interface net.bytebuddy.description.annotation.AnnotationSource
AnnotationSource.Empty, AnnotationSource.Explicit
-
Nested classes/interfaces inherited from interface net.bytebuddy.description.ModifierReviewable
ModifierReviewable.ForFieldDescription, ModifierReviewable.ForMethodDescription, ModifierReviewable.ForParameterDescription, ModifierReviewable.ForTypeDefinition, ModifierReviewable.OfAbstraction, ModifierReviewable.OfByteCodeElement, ModifierReviewable.OfEnumeration
-
Nested classes/interfaces inherited from interface net.bytebuddy.description.NamedElement
NamedElement.WithDescriptor, NamedElement.WithGenericName, NamedElement.WithOptionalName, NamedElement.WithRuntimeName
-
Nested classes/interfaces inherited from interface net.bytebuddy.description.type.TypeDefinition
TypeDefinition.Sort, TypeDefinition.SuperClassIterator
-
-
Field Summary
Fields Modifier and Type Field Description static TypeDescription.GenericANNOTATIONA representation of theAnnotationtype.static TypeDescription.GenericCLASSA representation of theClassnon-type.static TypeDescription.GenericOBJECTA representation of theObjecttype.static TypeDescription.GenericUNDEFINEDRepresents any undefined property representing a generic type description that is instead represented asnullin order to resemble the Java reflection API which returnsnulland is intuitive to many Java developers.static TypeDescription.GenericVOIDA representation of thevoidnon-type.-
Fields inherited from interface net.bytebuddy.description.ModifierReviewable
EMPTY_MASK
-
Fields inherited from interface net.bytebuddy.description.NamedElement
EMPTY_NAME, NO_NAME
-
Fields inherited from interface net.bytebuddy.description.type.TypeDefinition
RAW_TYPES_PROPERTY
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <T> Taccept(TypeDescription.Generic.Visitor<T> visitor)Applies a visitor to this generic type description.TypeDescription.GenericasRawType()Returns this type as a raw type.TypeDescription.GenericfindBindingOf(TypeDescription.Generic typeVariable)Returns the parameter binding of the supplied type variable.TypeDescription.GenericgetComponentType()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.GenericgetLowerBounds()Returns the lower bounds of this type.TypeDescription.GenericgetOwnerType()Returns the owner type of this type.RecordComponentList<RecordComponentDescription.InGenericShape>getRecordComponents()Returns the list of record components that are declared by this type.java.lang.StringgetSymbol()Returns the symbol of this type variable.TypeList.GenericgetTypeArguments()Returns the type arguments of this type.TypeVariableSourcegetTypeVariableSource()Returns the source of this type variable.TypeList.GenericgetUpperBounds()Returns the upper bounds of this type.-
Methods inherited from interface net.bytebuddy.description.annotation.AnnotationSource
getDeclaredAnnotations
-
Methods inherited from interface net.bytebuddy.description.ModifierReviewable
getModifiers, getSyntheticState, isFinal, isSynthetic
-
Methods inherited from interface net.bytebuddy.description.ModifierReviewable.ForTypeDefinition
getTypeManifestation, isAnnotation, isInterface
-
Methods inherited from interface net.bytebuddy.description.ModifierReviewable.OfAbstraction
isAbstract
-
Methods inherited from interface net.bytebuddy.description.ModifierReviewable.OfByteCodeElement
getOwnership, getVisibility, isDeprecated, isPackagePrivate, isPrivate, isProtected, isPublic, isStatic
-
Methods inherited from interface net.bytebuddy.description.ModifierReviewable.OfEnumeration
getEnumerationState, isEnum
-
Methods inherited from interface net.bytebuddy.description.NamedElement
getActualName
-
Methods inherited from interface net.bytebuddy.description.type.TypeDefinition
asErasure, asGenericType, getInterfaces, getSort, getStackSize, getSuperClass, getTypeName, isArray, isPrimitive, isRecord, represents
-
-
-
-
Field Detail
-
OBJECT
static final TypeDescription.Generic OBJECT
A representation of theObjecttype.
-
CLASS
static final TypeDescription.Generic CLASS
A representation of theClassnon-type.
-
VOID
static final TypeDescription.Generic VOID
A representation of thevoidnon-type.
-
ANNOTATION
static final TypeDescription.Generic ANNOTATION
A representation of theAnnotationtype.
-
UNDEFINED
static final TypeDescription.Generic UNDEFINED
Represents any undefined property representing a generic type description that is instead represented asnullin order to resemble the Java reflection API which returnsnulland is intuitive to many Java developers.
-
-
Method Detail
-
asRawType
TypeDescription.Generic asRawType()
Returns this type as a raw type. This resembles callingasErasure().asGenericType().- Returns:
- This type as a raw type.
-
getUpperBounds
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, anIllegalStateExceptionis thrown.- Returns:
- The upper bounds of this type.
-
getLowerBounds
TypeList.Generic getLowerBounds()
Returns the lower bounds of this type.
Only wildcard types (
TypeDefinition.Sort.WILDCARD) define a lower bound. For other types, anIllegalStateExceptionis thrown.- Returns:
- The lower bounds of this type.
-
getTypeArguments
TypeList.Generic getTypeArguments()
Returns the type arguments of this type.
Parameters are only well-defined for parameterized types (
TypeDefinition.Sort.PARAMETERIZED). For all other types, this method throws anIllegalStateException.- Returns:
- A list of this type's type parameters.
-
getOwnerType
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,
nullis returned.An owner type is only well-defined for parameterized types (
TypeDefinition.Sort.PARAMETERIZED), for non-generic types (TypeDefinition.Sort.NON_GENERIC) and for generic arrays (TypeDefinition.Sort.GENERIC_ARRAY). For all other types, this method throws anIllegalStateException.- Returns:
- This type's owner type or
nullif no owner type exists.
-
findBindingOf
TypeDescription.Generic findBindingOf(TypeDescription.Generic typeVariable)
Returns the parameter binding of the supplied type variable.
This method must only be called for parameterized types (
TypeDefinition.Sort.PARAMETERIZED). For all other types, this method throws anIllegalStateException.- Parameters:
typeVariable- The type variable for which a value should be located.- Returns:
- The value that is bound to the supplied type variable or
nullif the type variable is not bound by this parameterized type.
-
getTypeVariableSource
TypeVariableSource getTypeVariableSource()
Returns the source of this type variable. A type variable source is only well-defined for an attached type variable (TypeDefinition.Sort.VARIABLE. For other types, this method throws anIllegalStateException.- Returns:
- This type's type variable source.
-
getSymbol
java.lang.String getSymbol()
Returns the symbol of this type variable. A symbol is only well-defined for type variables (TypeDefinition.Sort.VARIABLE,TypeDefinition.Sort.VARIABLE_SYMBOLIC). For other types, this method throws anIllegalStateException.- Returns:
- This type's type variable symbol.
-
getComponentType
TypeDescription.Generic getComponentType()
Returns the component type of this type.
Only non-generic types (
TypeDefinition.Sort.NON_GENERIC) and generic array typesTypeDefinition.Sort.GENERIC_ARRAY) define a component type. For other types, anIllegalStateExceptionis thrown.- Specified by:
getComponentTypein interfaceTypeDefinition- Returns:
- The component type of this type or
nullif this type does not represent an array type.
-
getDeclaredFields
FieldList<FieldDescription.InGenericShape> getDeclaredFields()
Returns the fields that this type declares. A super type is only defined for non-generic types (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.- Specified by:
getDeclaredFieldsin interfaceTypeDefinition- Returns:
- The fields that this type declares. A super type is only defined for non-generic types (
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.
-
getDeclaredMethods
MethodList<MethodDescription.InGenericShape> getDeclaredMethods()
Returns the methods that this type declares.- Specified by:
getDeclaredMethodsin interfaceTypeDefinition- Returns:
- The methods that this type declares.
-
getRecordComponents
RecordComponentList<RecordComponentDescription.InGenericShape> getRecordComponents()
Returns the list of record components that are declared by this type. If this type is not a record, the returned list is empty.- Specified by:
getRecordComponentsin interfaceTypeDefinition- Returns:
- A list of record components that this type declares.
-
accept
<T> T accept(TypeDescription.Generic.Visitor<T> visitor)
Applies a visitor to this generic type description.- Type Parameters:
T- The value that this visitor yields.- Parameters:
visitor- The visitor to apply.- Returns:
- The visitor's return value.
-
-