Top Description Inners Fields Methods
net.bytebuddy.description.type

public Interface TypeDescription

extends TypeDefinition, ByteCodeElement, TypeVariableSource
Known Direct Subinterfaces
net.bytebuddy.dynamic.scaffold.InstrumentedType
Known Direct Implementers
net.bytebuddy.description.type.TypeDescription.AbstractBase
Imports
edu.umd.cs.findbugs.annotations.SuppressFBWarnings, net.bytebuddy.ClassFileVersion, net.bytebuddy.build.AccessControllerPlugin, .CachedReturnPlugin, .HashCodeAndEqualsPlugin, net.bytebuddy.description.ByteCodeElement, .ModifierReviewable, .TypeVariableSource, net.bytebuddy.description.annotation.AnnotationDescription, .AnnotationList, .AnnotationSource, net.bytebuddy.description.enumeration.EnumerationDescription, net.bytebuddy.description.field.FieldDescription, .FieldList, net.bytebuddy.description.method.MethodDescription, .MethodList, .ParameterDescription, net.bytebuddy.dynamic.TargetType, net.bytebuddy.implementation.bytecode.StackSize, net.bytebuddy.matcher.ElementMatcher, net.bytebuddy.utility.CompoundList, .FieldComparator, .GraalImageCode, .JavaType, net.bytebuddy.utility.dispatcher.JavaDispatcher, net.bytebuddy.utility.nullability.AlwaysNull, .MaybeNull, net.bytebuddy.utility.privilege.GetSystemPropertyAction, net.bytebuddy.jar.asm.Opcodes, .Type, net.bytebuddy.jar.asm.signature.SignatureVisitor, .SignatureWriter, java.io.Serializable, java.lang.annotation.Annotation, java.lang.reflect.*, java.security.PrivilegedAction, java.util.*

Implementations of this interface represent a Java type, i.e. a class or interface. Instances of this interface always represent non-generic types of sort Generic.Sort#NON_GENERIC.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public abstract static class
TypeDescription.AbstractBase

An abstract base implementation of a type description.

public static class
TypeDescription.ArrayProjection

A projection for an array type based on an existing TypeDescription.

public static class
TypeDescription.ForLoadedType

A type description implementation that represents a loaded type.

public static class
TypeDescription.ForPackageDescription

A type representation of a package description.

public static interface
TypeDescription.Generic

Represents a generic type of the Java programming language.

public static class
TypeDescription.Latent

A latent type description for a type without methods or fields.

public static class
TypeDescription.LazyProxy

A lazy proxy for representing a TypeDescription for a loaded type.

public static class
TypeDescription.SuperTypeLoading

A delegating type description that always attempts to load the super types of a delegate type.

Field Summary

Modifier and TypeField and Description
public static final TypeList.Generic
ARRAY_INTERFACES

A list of interfaces that are implicitly implemented by any array type.

public static final TypeDescription
CLASS

A representation of the java.lang.Class type.

public static final TypeDescription
OBJECT

A representation of the java.lang.Object type.

public static final TypeDescription
STRING

A representation of the java.lang.String type.

public static final TypeDescription
THROWABLE

A representation of the java.lang.Throwable type.

public static final TypeDescription
UNDEFINED

Hides net.bytebuddy.description.TypeVariableSource.UNDEFINED.

Represents any undefined property representing a 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.
public static final TypeDescription
VOID

A representation of the void non-type.

Inherited from net.bytebuddy.description.type.TypeDefinition:
RAW_TYPES_PROPERTY

Method Summary

Modifier and TypeMethod and Description
public TypeDescription

Returns:

A description of this type in its boxed form.
asBoxed
()

Returns a description of this type that represents this type as a boxed type for primitive types, unless its void.

public TypeDescription

Returns:

A description of this type in its unboxed form.
asUnboxed
()

Returns a description of this type that represents this type as an unboxed type for boxing types, unless its Void.

public int

Returns:

The type's actual modifiers.
getActualModifiers
(boolean
true if the modifier's super flag should be set.
superFlag
)

Returns the type's actual modifiers as present in the class file.

public String

Returns:

The canonical name of this type. Might be null.
getCanonicalName
()

Returns the canonical name of this type if it exists.

public ClassFileVersion

Returns:

This type's class file version or null if it cannot be resolved.
getClassFileVersion
()

Attempts to resolve the class file version of this type.

public TypeDescription
getComponentType()

Redeclares net.bytebuddy.description.type.TypeDefinition.getComponentType.

Returns the component type of this type.

public FieldList<FieldDescription.InDefinedShape>
getDeclaredFields()

Redeclares net.bytebuddy.description.type.TypeDefinition.getDeclaredFields.

Returns the fields that this type declares.
public MethodList<MethodDescription.InDefinedShape>
getDeclaredMethods()

Redeclares net.bytebuddy.description.type.TypeDefinition.getDeclaredMethods.

Returns the methods that this type declares.
public TypeList

Returns:

A list of types that are declared within this type.
getDeclaredTypes
()

Returns a list of types that are declared by this type.

public TypeDescription
getDeclaringType()

Redeclares net.bytebuddy.description.DeclaredByType.getDeclaringType.

Returns the declaring type of this instance.
public Object

Returns:

This types default value.
getDefaultValue
()

Returns the default value for this type, i.e. the zero value for a primitive type and null for a reference type.

public MethodDescription.InDefinedShape

Returns:

A description of the enclosing method of this type or null if there is no such method.
getEnclosingMethod
()

Returns a description of the method that encloses this type.

public TypeDescription

Returns:

A description of the enclosing type of this type or null if there is no such type.
getEnclosingType
()

Returns a description of this type's enclosing type if any.

public AnnotationList

Returns:

A list of all inherited annotations.
getInheritedAnnotations
()

Returns the annotations that this type declares or inherits from super types.

public int

Returns:

The number of outer classes relatively to this type.
getInnerClassCount
()

Returns the amount of outer classes this type defines.

public String

Returns:

The long form of the simple name of this type.
getLongSimpleName
()

Returns a form of a type's simple name which only shortens the package name but not the names of outer classes.

public TypeDescription

Returns:

The nest host of this type.
getNestHost
()

Returns the nest host of this type.

public TypeList

Returns:

A list of members of this nest group.
getNestMembers
()

Returns a list of members that are part of a nesting group.

public PackageDescription

Returns:

The package of the type described by this instance or null if the described type is a primitive type or an array.
getPackage
()

Returns the package of the type described by this instance or null if the described type is a primitive type or an array.

public TypeList

Returns:

The list of permitted subtypes or an empty list if this type is not sealed.
getPermittedSubtypes
()

Returns the list of permitted direct subclasses if this class is a sealed class.

public RecordComponentList<RecordComponentDescription.InDefinedShape>
getRecordComponents()

Redeclares net.bytebuddy.description.type.TypeDefinition.getRecordComponents.

Returns the list of record components that are declared by this type.
public String

Returns:

The simple name of this type.
getSimpleName
()

Returns the simple name of this type.

public boolean

Returns:

true if instances of this type can be returned from an annotation method.
isAnnotationReturnType
()

Checks if instances of this type can be returned from an annotation method.

public boolean

Returns:

true if instances of this type can be used for describing an annotation value.
isAnnotationValue
()

Checks if instances of this type can be used for describing an annotation value.

public boolean

Returns:

true if instances of this type can be used for describing the given annotation value..
isAnnotationValue
(Object
The value that is supposed to describe the annotation value for this instance.
value
)

Checks if instances of this type can be used for describing the given annotation value.

public boolean

Returns:

true if this type description represents an anonymous type.
isAnonymousType
()

Checks if this type description represents an anonymous type.

public boolean

Returns:

true if this type is assignable from type.
isAssignableFrom
(Class<?>
The type of interest.
type
)

Checks if this type is assignable from the type described by this instance, for example for class Foo and class Bar extends Foo, this method would return true for Foo.class.isAssignableFrom(Bar.class).

public boolean

Returns:

true if this type is assignable from type.
isAssignableFrom
(TypeDescription
The type of interest.
typeDescription
)

Checks if this type is assignable from the type described by this instance, for example for class Foo and class Bar extends Foo, this method would return true for Foo.class.isAssignableFrom(Bar.class).

public boolean

Returns:

true if this type is assignable to type.
isAssignableTo
(Class<?>
The type of interest.
type
)

Checks if this type is assignable from the type described by this instance, for example for class Foo and class Bar extends Foo, this method would return true for Bar.class.isAssignableTo(Foo.class).

public boolean

Returns:

true if this type is assignable to type.
isAssignableTo
(TypeDescription
The type of interest.
typeDescription
)

Checks if this type is assignable from the type described by this instance, for example for class Foo and class Bar extends Foo, this method would return true for Bar.class.isAssignableFrom(Foo.class).

public boolean

Returns:

true if this type represents a compile-time constant.
isCompileTimeConstant
()

Indicates if this type represents a compile-time constant, i.e. int, long, float, double, String, Class or java.lang.invoke.MethodHandle or java.lang.invoke.MethodType.

public boolean

Returns:

true if this type and the supplied type are in a type hierarchy with each other.
isInHierarchyWith
(Class<?>
The type of interest.
type
)

Returns true if this type and the supplied type are in a type hierarchy with each other, i.e. if this type is assignable to the supplied type or the other way around.

public boolean

Returns:

true if this type and the supplied type are in a type hierarchy with each other.
isInHierarchyWith
(TypeDescription
The type of interest.
typeDescription
)

Returns true if this type and the supplied type are in a type hierarchy with each other, i.e. if this type is assignable to the supplied type or the other way around.

public boolean

Returns:

true if this class is an inner class.
isInnerClass
()

Indicates if this class is an inner class.

public boolean

Returns:

true if the object is an instance of the type described by this instance.
isInstance
(Object
The object of interest.
value
)

Checks if value is an instance of the type represented by this instance.

public boolean

Returns:

true if this type description represents a local type.
isLocalType
()

Checks if this type description represents a local type.

public boolean

Returns:

true if this type description represents a member type.
isMemberType
()

Checks if this type description represents a member type.

public boolean

Returns:

true if this class is a nested class.
isNestedClass
()

Indicates if this class is a nested class.

public boolean

Returns:

true if this class is a nest group's host.
isNestHost
()

Checks if this class is the host of a nest group.

public boolean

Returns:

true if this type and the supplied type are members of the same nest group.
isNestMateOf
(Class<?>
The type for which to check if it is a member of the same nest group.
type
)

Checks if this type and the supplied type are members of the same nest group.

public boolean

Returns:

true if this type and the supplied type are members of the same nest group.
isNestMateOf
(TypeDescription
The type for which to check if it is a member of the same nest group.
typeDescription
)

Checks if this type and the supplied type are members of the same nest group.

public boolean

Returns:

true if this type represents a package description.
isPackageType
()

Checks if this type represents a class that is a place holder for a package description.

public boolean

Returns:

true if this type represents a wrapper type.
isPrimitiveWrapper
()

Checks if this type represents a wrapper type for a primitive type.

public boolean

Returns:

true if this type and the given type are in the same package.
isSamePackage
(TypeDescription
The type of interest.
typeDescription
)

Checks if two types are defined in the same package.

public boolean

Returns:

true if this class is a sealed class that only permitts a specified range of subclasses.
isSealed
()

Returns true if this class is a sealed class that only permitts a specified range of subclasses.

Inherited from net.bytebuddy.description.ByteCodeElement:
isAccessibleToisVisibleTo
Inherited from net.bytebuddy.description.type.TypeDefinition:
asErasureasGenericTypegetInterfacesgetSortgetStackSizegetSuperClassgetTypeNameisArrayisPrimitiveisRecordrepresents
Inherited from net.bytebuddy.description.TypeVariableSource:
acceptfindExpectedVariablefindVariablegetEnclosingSourcegetTypeVariablesisGenerifiedisInferrable