Package net.bytebuddy.description.type
Class TypeDescription.ArrayProjection
java.lang.Object
net.bytebuddy.description.ModifierReviewable.AbstractBase
net.bytebuddy.description.TypeVariableSource.AbstractBase
net.bytebuddy.description.type.TypeDescription.AbstractBase
net.bytebuddy.description.type.TypeDescription.ArrayProjection
- All Implemented Interfaces:
Iterable<TypeDefinition>
,AnnotationSource
,ByteCodeElement
,DeclaredByType
,ModifierReviewable
,ModifierReviewable.ForFieldDescription
,ModifierReviewable.ForMethodDescription
,ModifierReviewable.ForParameterDescription
,ModifierReviewable.ForTypeDefinition
,ModifierReviewable.OfAbstraction
,ModifierReviewable.OfByteCodeElement
,ModifierReviewable.OfEnumeration
,NamedElement
,NamedElement.WithDescriptor
,NamedElement.WithRuntimeName
,TypeDefinition
,TypeDescription
,TypeVariableSource
- Enclosing interface:
TypeDescription
A projection for an array type based on an existing
TypeDescription
.-
Nested Class Summary
Nested classes/interfaces inherited from class net.bytebuddy.description.type.TypeDescription.AbstractBase
TypeDescription.AbstractBase.OfSimpleType
Nested classes/interfaces inherited from interface net.bytebuddy.description.annotation.AnnotationSource
AnnotationSource.Empty, AnnotationSource.Explicit
Nested classes/interfaces inherited from interface net.bytebuddy.description.ByteCodeElement
ByteCodeElement.Member, ByteCodeElement.Token<T extends ByteCodeElement.Token<T>>, ByteCodeElement.TypeDependant<T extends ByteCodeElement.TypeDependant<?,
S>, S extends ByteCodeElement.Token<S>> Nested classes/interfaces inherited from interface net.bytebuddy.description.DeclaredByType
DeclaredByType.WithMandatoryDeclaration
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
TypeDescription.AbstractBase, TypeDescription.ArrayProjection, TypeDescription.ForLoadedType, TypeDescription.ForPackageDescription, TypeDescription.Generic, TypeDescription.Latent, TypeDescription.LazyProxy, TypeDescription.SuperTypeLoading
Nested classes/interfaces inherited from interface net.bytebuddy.description.TypeVariableSource
TypeVariableSource.AbstractBase, TypeVariableSource.Visitor<T>
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final int
The arity of this array.private static final int
Modifiers that no array in Java displays.private static final int
Modifiers that every array in Java implies.private final TypeDescription
The base component type which is itself not an array.Fields inherited from class net.bytebuddy.description.type.TypeDescription.AbstractBase
RAW_TYPES
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.NamedElement.WithDescriptor
NON_GENERIC_SIGNATURE
Fields inherited from interface net.bytebuddy.description.type.TypeDefinition
RAW_TYPES_PROPERTY
Fields inherited from interface net.bytebuddy.description.type.TypeDescription
ARRAY_INTERFACES, CLASS, OBJECT, STRING, THROWABLE, UNDEFINED, VOID
Fields inherited from interface net.bytebuddy.description.TypeVariableSource
UNDEFINED
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
ArrayProjection
(TypeDescription componentType, int arity) Creates a new array projection. -
Method Summary
Modifier and TypeMethodDescriptionReturns the canonical name of this type if it exists.Returns the component type of this type.Returns a list of annotations that are declared by this instance.Returns the fields that this type declares.Returns the methods that this type declares.Returns a list of types that are declared by this type.Returns the declaring type of this instance.Returns the descriptor of this byte code element.Returns a description of the method that encloses this type.Returns a description of this type's enclosing type if any.Returns the annotations that this type declares or inherits from super types.Returns the interfaces that this type implements.int
Returns the modifier that is described by this object.getName()
Returns the binary name of this byte code element.Returns the nest host of this type.Returns a list of members that are part of a nesting group.Returns the package of the type described by this instance ornull
if the described type is a primitive type or an array.Returns the list of permitted direct subclasses if this class is a sealed class.Returns the list of record components that are declared by this type.Returns the simple name of this type.Returns the size of the type described by this instance.Returns the super class of this type.Returns the type variables that are declared by this element.boolean
Checks if this type description represents an anonymous type.boolean
isArray()
Checks if the type described by this entity is an array.boolean
Checks if this type description represents a local type.boolean
Checks if this type description represents a member type.boolean
Checks if the type described by this entity is a primitive type.boolean
isRecord()
Checks if this type is a Java record.static TypeDescription
of
(TypeDescription componentType) Creates an array projection of an arity of one.static TypeDescription
of
(TypeDescription componentType, int arity) Creates an array projection.Methods inherited from class net.bytebuddy.description.type.TypeDescription.AbstractBase
accept, asBoxed, asErasure, asGenericType, asUnboxed, equals, getActualModifiers, getActualName, getClassFileVersion, getDefaultValue, getEnclosingSource, getGenericSignature, getInnerClassCount, getInternalName, getLongSimpleName, getSort, getTypeName, hashCode, isAccessibleTo, isAnnotationReturnType, isAnnotationValue, isAnnotationValue, isAssignableFrom, isAssignableFrom, isAssignableTo, isAssignableTo, isCompileTimeConstant, isGenerified, isInferrable, isInHierarchyWith, isInHierarchyWith, isInnerClass, isInstance, isNestedClass, isNestHost, isNestMateOf, isNestMateOf, isPackageType, isPrimitiveWrapper, isSamePackage, isSealed, isVisibleTo, iterator, represents, toSafeString, toString
Methods inherited from class net.bytebuddy.description.TypeVariableSource.AbstractBase
findExpectedVariable, findVariable
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 java.lang.Iterable
forEach, spliterator
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
Methods inherited from interface net.bytebuddy.description.TypeVariableSource
findExpectedVariable, findVariable
-
Field Details
-
ARRAY_IMPLIED
private static final int ARRAY_IMPLIEDModifiers that every array in Java implies.- See Also:
-
ARRAY_EXCLUDED
private static final int ARRAY_EXCLUDEDModifiers that no array in Java displays.- See Also:
-
componentType
The base component type which is itself not an array. -
arity
private final int arityThe arity of this array.
-
-
Constructor Details
-
ArrayProjection
Creates a new array projection.- Parameters:
componentType
- The base component type of the array which is itself not an array.arity
- The arity of this array.
-
-
Method Details
-
of
Creates an array projection of an arity of one.- Parameters:
componentType
- The component type of the array.- Returns:
- A projection of the component type as an array of the given value with an arity of one.
-
of
Creates an array projection.- Parameters:
componentType
- The component type of the array.arity
- The arity of this array.- Returns:
- A projection of the component type as an array of the given value with the supplied arity.
-
isArray
public boolean isArray()Checks if the type described by this entity is an array.- Returns:
true
if this type description represents an array.
-
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.
-
isPrimitive
public boolean isPrimitive()Checks if the type described by this entity is a primitive type.- Returns:
true
if this type description represents a primitive type.
-
getSuperClass
Returns the super class of this type. 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. Interface types and theObject
class do not define a super class wherenull
is returned. Array types defineObject
as their direct super class.- Returns:
- The super class of this type or
null
if no super class exists for this type.
-
getInterfaces
Returns the interfaces that this type implements. 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.- Returns:
- The interfaces that this type implements.
-
getEnclosingMethod
Returns a description of the method that encloses this type. If this method is not enclosed by any type or is enclosed by the type initializer,null
is returned by this method.- Returns:
- A description of the enclosing method of this type or
null
if there is no such method.
-
getEnclosingType
Returns a description of this type's enclosing type if any.- Returns:
- A description of the enclosing type of this type or
null
if there is no such type.
-
getDeclaredTypes
Returns a list of types that are declared by this type. This list does not normally include anonymous types but might include additional types if they are explicitly added to an instrumented type.- Returns:
- A list of types that are declared within this type.
-
getSimpleName
Returns the simple name of this type.- Returns:
- The simple name of this type.
-
getCanonicalName
Returns the canonical name of this type if it exists.- Returns:
- The canonical name of this type. Might be
null
.
-
isAnonymousType
public boolean isAnonymousType()Checks if this type description represents an anonymous type.- Returns:
true
if this type description represents an anonymous type.
-
isLocalType
public boolean isLocalType()Checks if this type description represents a local type.- Returns:
true
if this type description represents a local type.
-
isMemberType
public boolean isMemberType()Description copied from class:TypeDescription.AbstractBase
Checks if this type description represents a member type.- Specified by:
isMemberType
in interfaceTypeDescription
- Overrides:
isMemberType
in classTypeDescription.AbstractBase
- Returns:
true
if this type description represents a member type.
-
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.- 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
Returns the methods that this type declares.- Returns:
- The methods that this type declares.
-
getStackSize
Returns the size of the type described by this instance. Wildcard types (TypeDefinition.Sort.WILDCARD
do not have a well-defined a stack size and cause anIllegalStateException
to be thrown.- Returns:
- The size of the type described by this instance.
-
getDeclaredAnnotations
Returns a list of annotations that are declared by this instance.- Returns:
- A list of declared annotations.
-
getInheritedAnnotations
Returns the annotations that this type declares or inherits from super types.- Specified by:
getInheritedAnnotations
in interfaceTypeDescription
- Overrides:
getInheritedAnnotations
in classTypeDescription.AbstractBase
- Returns:
- A list of all inherited annotations.
-
getPackage
Returns the package of the type described by this instance ornull
if the described type is a primitive type or an array.- Returns:
- The package of the type described by this instance or
null
if the described type is a primitive type or an array.
-
getName
Returns the binary name of this byte code element. If no well-defined internal name is known for this element, the actual name is returned.- Returns:
- The binary ame of this byte code element as visible from within a running Java application.
-
getDescriptor
Returns the descriptor of this byte code element.- Returns:
- The descriptor of this byte code element.
-
getDeclaringType
Returns the declaring type of this instance.- Returns:
- The declaring type or
null
if no such type exists.
-
getModifiers
public int getModifiers()Returns the modifier that is described by this object.- Returns:
- The modifier that is described by this object.
-
getTypeVariables
Returns the type variables that are declared by this element.- Returns:
- The type variables that are declared by this element.
-
getNestHost
Returns the nest host of this type. For types prior to Java 11, this type is returned which is the default nest host.- Returns:
- The nest host of this type.
-
getNestMembers
Returns a list of members that are part of a nesting group. Prior to Java 11, a list that only contains this type is returned which is the default nest group.- Returns:
- A list of members of this nest group.
-
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.- Returns:
- A list of record components that this type declares.
-
isRecord
public boolean isRecord()Checks if this type is a Java record.- Returns:
true
if this type is a Java record.
-
getPermittedSubtypes
Returns the list of permitted direct subclasses if this class is a sealed class. Permitted subclasses might or might not be resolvable, where unresolvable subclasses might also be missing from the list. For returned types, methods that return the class's name will always be invokable without errors. If this type is not sealed, an empty list is returned. Note that an empty list might also be returned for a sealed type, if no type permitted subtype is resolvable.- Returns:
- The list of permitted subtypes or an empty list if this type is not sealed.
-