Top Description Inners Fields Constructors Methods
net.bytebuddy.utility

public final Enum JavaType

extends Enum<JavaType>
Class Inheritance
Imports
net.bytebuddy.build.CachedReturnPlugin, net.bytebuddy.description.type.TypeDefinition, .TypeDescription, .TypeList, net.bytebuddy.dynamic.loading.ClassLoadingStrategy, net.bytebuddy.utility.nullability.MaybeNull, net.bytebuddy.jar.asm.Opcodes, java.io.Serializable, java.lang.reflect.*, java.util.List

Representations of Java types that do not exist in Java 6 but that have a special meaning to the JVM.

Nested and Inner Type Summary

Modifier and TypeClass and Description
protected static class
JavaType.LatentTypeWithSimpleName

A latent type that resolves the simple name without considering the declaring type which is not normally available.

Field Summary

Modifier and TypeField and Description
public static final JavaType
ACCESS_CONTROL_CONTEXT

The java.security.AccessControlContext type which is deprecated for removal beginning in Java 17.

public static final JavaType
CALL_SITE

The Java 7 java.lang.invoke.CallSite type.

public static final JavaType
CLASS_DESCRIPTION

The Java 12 java.lang.constant.ClassDesc type.

public static final JavaType
CONSTABLE

The Java 12 java.lang.constant.Constable type.

public static final JavaType
CONSTANT_BOOTSTRAPS

The Java 12 java.lang.invoke.ConstantBootstraps type.

public static final JavaType
CONSTANT_DESCRIPTION

The Java 12 java.lang.constant.ConstableDesc type.

public static final JavaType
DIRECT_METHOD_HANDLE_DESCRIPTION

The Java 12 java.lang.constant.DirectMethodHandleDesc type.

public static final JavaType
DYNAMIC_CONSTANT_DESCRIPTION

The Java 12 java.lang.constant.DynamicConstantDesc type.

public static final JavaType
EXECUTABLE

The Java 7 java.lang.reflect.Executable type.

public static final JavaType
METHOD_HANDLE

The Java 7 java.lang.invoke.MethodHandle type.

public static final JavaType
METHOD_HANDLE_DESCRIPTION

The Java 12 java.lang.constant.MethodHandleDesc type.

public static final JavaType
METHOD_HANDLES

The Java 7 java.lang.invoke.MethodHandles type.

public static final JavaType
METHOD_HANDLES_LOOKUP

The Java 7 java.lang.invoke.MethodTypes.Lookup type.

public static final JavaType
METHOD_TYPE

The Java 7 java.lang.invoke.MethodType type.

public static final JavaType
METHOD_TYPE_DESCRIPTION

The Java 12 java.lang.constant.MethodTypeDesc type.

public static final JavaType
MODULE

The Java 9 java.lang.Module type.

public static final JavaType
OBJECT_METHODS

The Java 14 java.lang.runtime.ObjectMethods type.

public static final JavaType
PARAMETER

The Java 8 java.lang.reflect.Parameter type.

public static final JavaType
RECORD

The Java 14 java.lang.Record type.

public static final JavaType
TYPE_DESCRIPTOR

The Java 12 java.lang.invoke.TypeDescriptor type.

public static final JavaType
TYPE_DESCRIPTOR_OF_FIELD

The Java 12 java.lang.invoke.TypeDescriptor$OfMethod type.

public static final JavaType
TYPE_DESCRIPTOR_OF_METHOD

The Java 12 java.lang.invoke.TypeDescriptor$OfMethod type.

private final TypeDescription
typeDescription

The type description to represent this type which is either a loaded type or a stub.

public static final JavaType
VAR_HANDLE

The Java 9 java.lang.invoke.VarHandle type.

Constructor Summary

AccessConstructor and Description
private
JavaType(String
The binary name of this type.
typeName
,
int
The modifiers of this type when creating a stub.
modifiers
,
Type
The super class of this type when creating a stub or null if no super class is defined.
superClass
,
Type...
The interfaces of this type when creating a stub.
anInterface
)

Creates a new java type representation.

private
JavaType(String
The binary name of this type.
typeName
,
int
The modifiers of this type when creating a stub.
modifiers
,
TypeDefinition
The super class of this type when creating a stub or null if no super class is defined.
superClass
,
TypeDefinition...
The interfaces of this type when creating a stub.
anInterface
)

Creates a new java type representation.

private
JavaType(String
The binary name of this type.
typeName
,
int
The modifiers of this type when creating a stub.
modifiers
,
TypeDescription.Generic
The super class of this type when creating a stub or null if no super class is defined.
superClass
,
TypeList.Generic
The interfaces of this type when creating a stub.
interfaces
)

Creates a new java type representation.

Method Summary

Modifier and TypeMethod and Description
private Boolean

Returns:

true if this type is available on the current JVM.
doIsAvailable
()

Returns true if this type is available on the current VM.

public TypeDescription

Returns:

A type description for this Java type.
getTypeStub
()

Returns at least a stub representing this type where the stub does not define any methods or fields.

public boolean

Returns:

true if this type is available on the current JVM.
isAvailable
()

Returns true if this type is available on the current JVM.

public boolean

Returns:

true if the supplied object is an instance of this type.
isInstance
(Object
The instance to check.
instance
)

Checks if the supplied object is an instance of this type.

public Class<?>

Returns:

A loaded type of this Java type.
load
()

Loads the class that is represented by this Java type.

public TypeDescription

Returns:

A loaded type of this Java type.
loadAsDescription
()

Loads the class that is represented by this Java type and represents it as a TypeDescription.

public static JavaType
public static JavaType[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

ACCESS_CONTROL_CONTEXTback to summary
public static final JavaType ACCESS_CONTROL_CONTEXT

The java.security.AccessControlContext type which is deprecated for removal beginning in Java 17.

CALL_SITEback to summary
public static final JavaType CALL_SITE

The Java 7 java.lang.invoke.CallSite type.

CLASS_DESCRIPTIONback to summary
public static final JavaType CLASS_DESCRIPTION

The Java 12 java.lang.constant.ClassDesc type.

CONSTABLEback to summary
public static final JavaType CONSTABLE

The Java 12 java.lang.constant.Constable type.

CONSTANT_BOOTSTRAPSback to summary
public static final JavaType CONSTANT_BOOTSTRAPS

The Java 12 java.lang.invoke.ConstantBootstraps type.

CONSTANT_DESCRIPTIONback to summary
public static final JavaType CONSTANT_DESCRIPTION

The Java 12 java.lang.constant.ConstableDesc type.

DIRECT_METHOD_HANDLE_DESCRIPTIONback to summary
public static final JavaType DIRECT_METHOD_HANDLE_DESCRIPTION

The Java 12 java.lang.constant.DirectMethodHandleDesc type.

DYNAMIC_CONSTANT_DESCRIPTIONback to summary
public static final JavaType DYNAMIC_CONSTANT_DESCRIPTION

The Java 12 java.lang.constant.DynamicConstantDesc type.

EXECUTABLEback to summary
public static final JavaType EXECUTABLE

The Java 7 java.lang.reflect.Executable type.

METHOD_HANDLEback to summary
public static final JavaType METHOD_HANDLE

The Java 7 java.lang.invoke.MethodHandle type.

METHOD_HANDLE_DESCRIPTIONback to summary
public static final JavaType METHOD_HANDLE_DESCRIPTION

The Java 12 java.lang.constant.MethodHandleDesc type.

METHOD_HANDLESback to summary
public static final JavaType METHOD_HANDLES

The Java 7 java.lang.invoke.MethodHandles type.

METHOD_HANDLES_LOOKUPback to summary
public static final JavaType METHOD_HANDLES_LOOKUP

The Java 7 java.lang.invoke.MethodTypes.Lookup type.

METHOD_TYPEback to summary
public static final JavaType METHOD_TYPE

The Java 7 java.lang.invoke.MethodType type.

METHOD_TYPE_DESCRIPTIONback to summary
public static final JavaType METHOD_TYPE_DESCRIPTION

The Java 12 java.lang.constant.MethodTypeDesc type.

MODULEback to summary
public static final JavaType MODULE

The Java 9 java.lang.Module type.

OBJECT_METHODSback to summary
public static final JavaType OBJECT_METHODS

The Java 14 java.lang.runtime.ObjectMethods type.

PARAMETERback to summary
public static final JavaType PARAMETER

The Java 8 java.lang.reflect.Parameter type.

RECORDback to summary
public static final JavaType RECORD

The Java 14 java.lang.Record type.

TYPE_DESCRIPTORback to summary
public static final JavaType TYPE_DESCRIPTOR

The Java 12 java.lang.invoke.TypeDescriptor type.

TYPE_DESCRIPTOR_OF_FIELDback to summary
public static final JavaType TYPE_DESCRIPTOR_OF_FIELD

The Java 12 java.lang.invoke.TypeDescriptor$OfMethod type.

TYPE_DESCRIPTOR_OF_METHODback to summary
public static final JavaType TYPE_DESCRIPTOR_OF_METHOD

The Java 12 java.lang.invoke.TypeDescriptor$OfMethod type.

typeDescriptionback to summary
private final TypeDescription typeDescription

The type description to represent this type which is either a loaded type or a stub.

VAR_HANDLEback to summary
public static final JavaType VAR_HANDLE

The Java 9 java.lang.invoke.VarHandle type.

Constructor Detail

JavaTypeback to summary
private JavaType(String typeName, int modifiers, Type superClass, Type... anInterface)

Creates a new java type representation.

Parameters
typeName:String

The binary name of this type.

modifiers:int

The modifiers of this type when creating a stub.

superClass:Type

The super class of this type when creating a stub or null if no super class is defined.

anInterface:Type[]

The interfaces of this type when creating a stub.

JavaTypeback to summary
private JavaType(String typeName, int modifiers, TypeDefinition superClass, TypeDefinition... anInterface)

Creates a new java type representation.

Parameters
typeName:String

The binary name of this type.

modifiers:int

The modifiers of this type when creating a stub.

superClass:TypeDefinition

The super class of this type when creating a stub or null if no super class is defined.

anInterface:TypeDefinition[]

The interfaces of this type when creating a stub.

JavaTypeback to summary
private JavaType(String typeName, int modifiers, TypeDescription.Generic superClass, TypeList.Generic interfaces)

Creates a new java type representation.

Parameters
typeName:String

The binary name of this type.

modifiers:int

The modifiers of this type when creating a stub.

superClass:TypeDescription.Generic

The super class of this type when creating a stub or null if no super class is defined.

interfaces:TypeList.Generic

The interfaces of this type when creating a stub.

Method Detail

doIsAvailableback to summary
private Boolean doIsAvailable()

Returns true if this type is available on the current VM. By boxing the result, the result can be cached efficiently what is not possible when using a primitive type.

Returns:Boolean

true if this type is available on the current JVM.

Annotations
@Enhance:available
getTypeStubback to summary
public TypeDescription getTypeStub()

Returns at least a stub representing this type where the stub does not define any methods or fields. If a type exists for the current runtime, a loaded type representation is returned.

Returns:TypeDescription

A type description for this Java type.

isAvailableback to summary
public boolean isAvailable()

Returns true if this type is available on the current JVM.

Returns:boolean

true if this type is available on the current JVM.

isInstanceback to summary
public boolean isInstance(Object instance)

Checks if the supplied object is an instance of this type.

Parameters
instance:Object

The instance to check.

Returns:boolean

true if the supplied object is an instance of this type.

loadback to summary
public Class<?> load() throws ClassNotFoundException

Loads the class that is represented by this Java type.

Returns:Class<?>

A loaded type of this Java type.

Annotations
@Enhance:loaded
Exceptions
ClassNotFoundException:
If the represented type cannot be loaded.
loadAsDescriptionback to summary
public TypeDescription loadAsDescription() throws ClassNotFoundException

Loads the class that is represented by this Java type and represents it as a TypeDescription.

Returns:TypeDescription

A loaded type of this Java type.

Exceptions
ClassNotFoundException:
If the represented type cannot be loaded.
valueOfback to summary
public static JavaType valueOf(String name)
valuesback to summary
public static JavaType[] values()
net.bytebuddy.utility back to summary

protected Class JavaType.LatentTypeWithSimpleName

extends Latent
Class Inheritance

A latent type that resolves the simple name without considering the declaring type which is not normally available. This is required since the JavaConstant replication of Java's string representation uses the simple name.

Constructor Summary

AccessConstructor and Description
protected
LatentTypeWithSimpleName(String
The name of the type.
name
,
int
The modifiers of the type.
modifiers
,
TypeDescription.Generic
The super type or null if no such type exists.
superClass
,
List<? extends TypeDescription.Generic>
The interfaces that this type implements.
interfaces
)

Creates a new latent type with a simple name.

Method Summary

Modifier and TypeMethod and Description
public String
Inherited from net.bytebuddy.description.type.TypeDescription.Latent:
getDeclaredAnnotationsgetDeclaredFieldsgetDeclaredMethodsgetDeclaredTypesgetDeclaringTypegetEnclosingMethodgetEnclosingTypegetInterfacesgetModifiersgetNamegetNestHostgetNestMembersgetPackagegetPermittedSubtypesgetRecordComponentsgetSuperClassgetTypeVariablesisAnonymousTypeisLocalTypeisRecord

Constructor Detail

LatentTypeWithSimpleNameback to summary
protected LatentTypeWithSimpleName(String name, int modifiers, TypeDescription.Generic superClass, List<? extends TypeDescription.Generic> interfaces)

Creates a new latent type with a simple name.

Parameters
name:String

The name of the type.

modifiers:int

The modifiers of the type.

superClass:TypeDescription.Generic

The super type or null if no such type exists.

interfaces:List<? extends TypeDescription.Generic>

The interfaces that this type implements.

Method Detail

getSimpleNameback to summary
public String getSimpleName()

Overrides net.bytebuddy.description.type.TypeDescription.AbstractBase.OfSimpleType.getSimpleName.

Implements net.bytebuddy.description.type.TypeDescription.getSimpleName.

Doc from net.bytebuddy.description.type.TypeDescription.AbstractBase.OfSimpleType.getSimpleName.

Returns the simple name of this type.

Returns:String

Doc from net.bytebuddy.description.type.TypeDescription.getSimpleName.

The simple name of this type.

Annotations
@Override