Class TypeDescription.Generic.OfNonGenericType.ForLoadedType
- java.lang.Object
-
- net.bytebuddy.description.ModifierReviewable.AbstractBase
-
- net.bytebuddy.description.type.TypeDescription.Generic.AbstractBase
-
- net.bytebuddy.description.type.TypeDescription.Generic.OfNonGenericType
-
- net.bytebuddy.description.type.TypeDescription.Generic.OfNonGenericType.ForLoadedType
-
- All Implemented Interfaces:
java.lang.Iterable<TypeDefinition>
,AnnotationSource
,ModifierReviewable
,ModifierReviewable.ForFieldDescription
,ModifierReviewable.ForMethodDescription
,ModifierReviewable.ForParameterDescription
,ModifierReviewable.ForTypeDefinition
,ModifierReviewable.OfAbstraction
,ModifierReviewable.OfByteCodeElement
,ModifierReviewable.OfEnumeration
,NamedElement
,TypeDefinition
,TypeDescription.Generic
- Enclosing class:
- TypeDescription.Generic.OfNonGenericType
public static class TypeDescription.Generic.OfNonGenericType.ForLoadedType extends TypeDescription.Generic.OfNonGenericType
Represents a non-generic type for a loadedClass
.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class net.bytebuddy.description.type.TypeDescription.Generic.OfNonGenericType
TypeDescription.Generic.OfNonGenericType.ForErasure, TypeDescription.Generic.OfNonGenericType.ForLoadedType, TypeDescription.Generic.OfNonGenericType.ForReifiedErasure, TypeDescription.Generic.OfNonGenericType.Latent
-
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.AbstractBase, 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
-
Nested classes/interfaces inherited from interface net.bytebuddy.description.type.TypeDescription.Generic
TypeDescription.Generic.AbstractBase, TypeDescription.Generic.AnnotationReader, TypeDescription.Generic.Builder, TypeDescription.Generic.LazyProjection, TypeDescription.Generic.OfGenericArray, TypeDescription.Generic.OfNonGenericType, TypeDescription.Generic.OfParameterizedType, TypeDescription.Generic.OfTypeVariable, TypeDescription.Generic.OfWildcardType, TypeDescription.Generic.Visitor<T>
-
-
Field Summary
Fields Modifier and Type Field Description private TypeDescription.Generic.AnnotationReader
annotationReader
The annotation reader to query for the non-generic type's annotations.private java.lang.Class<?>
type
The type that this instance represents.private static java.util.Map<java.lang.Class<?>,TypeDescription.Generic>
TYPE_CACHE
A cache of generic type descriptions for commonly used types to avoid unnecessary allocations.-
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
-
Fields inherited from interface net.bytebuddy.description.type.TypeDescription.Generic
ANNOTATION, CLASS, OBJECT, UNDEFINED, VOID
-
-
Constructor Summary
Constructors Modifier Constructor Description ForLoadedType(java.lang.Class<?> type)
Creates a new description of a generic type of a loaded type.protected
ForLoadedType(java.lang.Class<?> type, TypeDescription.Generic.AnnotationReader annotationReader)
/** Creates a new description of a generic type of a loaded type.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description TypeDescription
asErasure()
Returns the erasure of this type.TypeDescription.Generic
getComponentType()
Returns the component type of this type.AnnotationList
getDeclaredAnnotations()
Returns a list of annotations that are declared by this instance.TypeDescription.Generic
getOwnerType()
Returns the owner type of this type.static TypeDescription.Generic
of(java.lang.Class<?> type)
Returns a new immutable generic type description for a loaded type.boolean
represents(java.lang.reflect.Type type)
Checks if the type described by this instance representstype
.-
Methods inherited from class net.bytebuddy.description.type.TypeDescription.Generic.OfNonGenericType
accept, equals, findBindingOf, getActualName, getDeclaredFields, getDeclaredMethods, getInterfaces, getLowerBounds, getRecordComponents, getSort, getStackSize, getSuperClass, getSymbol, getTypeArguments, getTypeName, getTypeVariableSource, getUpperBounds, hashCode, isArray, isPrimitive, isRecord, iterator, toString
-
Methods inherited from class net.bytebuddy.description.type.TypeDescription.Generic.AbstractBase
asGenericType, asRawType, getModifiers
-
Methods inherited from class net.bytebuddy.description.ModifierReviewable.AbstractBase
getEnumerationState, getFieldManifestation, getFieldPersistence, getMethodManifestation, getMethodStrictness, getOwnership, getParameterManifestation, getProvisioningState, getSynchronizationState, getSyntheticState, getTypeManifestation, getVisibility, isAbstract, isAnnotation, isBridge, isDeprecated, isEnum, isFinal, isInterface, isMandated, isNative, isPackagePrivate, isPrivate, isProtected, isPublic, isStatic, isStrict, isSynchronized, isSynthetic, isTransient, isVarArgs, isVolatile
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface net.bytebuddy.description.ModifierReviewable
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
-
-
-
-
Field Detail
-
TYPE_CACHE
private static final java.util.Map<java.lang.Class<?>,TypeDescription.Generic> TYPE_CACHE
A cache of generic type descriptions for commonly used types to avoid unnecessary allocations.
-
type
private final java.lang.Class<?> type
The type that this instance represents.
-
annotationReader
private final TypeDescription.Generic.AnnotationReader annotationReader
The annotation reader to query for the non-generic type's annotations.
-
-
Constructor Detail
-
ForLoadedType
public ForLoadedType(java.lang.Class<?> type)
Creates a new description of a generic type of a loaded type. This constructor should not normally be used. Useof(Class)
instead.- Parameters:
type
- The represented type.
-
ForLoadedType
protected ForLoadedType(java.lang.Class<?> type, TypeDescription.Generic.AnnotationReader annotationReader)
/** Creates a new description of a generic type of a loaded type.- Parameters:
type
- The represented type.annotationReader
- The annotation reader to query for the non-generic type's annotations.
-
-
Method Detail
-
of
public static TypeDescription.Generic of(java.lang.Class<?> type)
Returns a new immutable generic type description for a loaded type.- Parameters:
type
- The type to be represented by this generic type description.- Returns:
- The generic type description representing the given type.
-
asErasure
public TypeDescription asErasure()
Returns the erasure of this type. Wildcard types (TypeDefinition.Sort.WILDCARD
) do not have a well-defined erasure and cause anIllegalStateException
to be thrown.- Returns:
- The erasure of this type.
-
getOwnerType
public 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 (
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
null
if no owner type exists.
-
getComponentType
public 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, anIllegalStateException
is thrown.- Returns:
- The component type of this type or
null
if this type does not represent an array type.
-
getDeclaredAnnotations
public AnnotationList getDeclaredAnnotations()
Returns a list of annotations that are declared by this instance.- Returns:
- A list of declared annotations.
-
represents
public boolean represents(java.lang.reflect.Type type)
Checks if the type described by this instance representstype
.- Specified by:
represents
in interfaceTypeDefinition
- Overrides:
represents
in classTypeDescription.Generic.OfNonGenericType
- Parameters:
type
- The type of interest.- Returns:
true
if the type described by this instance representstype
.
-
-