Enum JavaConstant.MethodHandle.HandleType
java.lang.Object
java.lang.Enum<JavaConstant.MethodHandle.HandleType>
net.bytebuddy.utility.JavaConstant.MethodHandle.HandleType
- All Implemented Interfaces:
Serializable, Comparable<JavaConstant.MethodHandle.HandleType>, java.lang.constant.Constable
- Enclosing class:
JavaConstant.MethodHandle
public static enum JavaConstant.MethodHandle.HandleType
extends Enum<JavaConstant.MethodHandle.HandleType>
A representation of a method handle's type.
-
Nested Class Summary
Nested classes/interfaces inherited from class Enum
Enum.EnumDesc<E> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionA handle representing a read of a non-static field invocation.A handle representing a read of a static field invocation.A handle representing an invokeinterface invocation.A handle representing an invokespecial invocation for a non-constructor.A handle representing an invokespecial invocation for a constructor.A handle representing an invokestatic invocation.A handle representing an invokevirtual invocation.A handle representing a write of a non-static field invocation.A handle representing a write of a static field invocation. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final booleantrue if this handle type represents a field handle.private final intThe represented identifier. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateHandleType(int identifier, boolean field) Creates a new handle type. -
Method Summary
Modifier and TypeMethodDescriptionintReturns the represented identifier.booleanisField()Returns true if this handle type represents a field handle.protected static JavaConstant.MethodHandle.HandleTypeof(int identifier) Extracts a handle type for the given identifier.protected static JavaConstant.MethodHandle.HandleTypeof(MethodDescription.InDefinedShape methodDescription) Extracts a handle type for invoking the given method.protected static JavaConstant.MethodHandle.HandleTypeofGetter(FieldDescription.InDefinedShape fieldDescription) Extracts a handle type for a getter of the given field.protected static JavaConstant.MethodHandle.HandleTypeofSetter(FieldDescription.InDefinedShape fieldDescription) Extracts a handle type for a setter of the given field.protected static JavaConstant.MethodHandle.HandleTypeofSpecial(MethodDescription.InDefinedShape methodDescription) Extracts a handle type for invoking the given method via invokespecial.Returns the enum constant of this type with the specified name.static JavaConstant.MethodHandle.HandleType[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
Enum Constant Details
-
INVOKE_VIRTUAL
A handle representing an invokevirtual invocation. -
INVOKE_STATIC
A handle representing an invokestatic invocation. -
INVOKE_SPECIAL
A handle representing an invokespecial invocation for a non-constructor. -
INVOKE_INTERFACE
A handle representing an invokeinterface invocation. -
INVOKE_SPECIAL_CONSTRUCTOR
A handle representing an invokespecial invocation for a constructor. -
PUT_FIELD
A handle representing a write of a non-static field invocation. -
GET_FIELD
A handle representing a read of a non-static field invocation. -
PUT_STATIC_FIELD
A handle representing a write of a static field invocation. -
GET_STATIC_FIELD
A handle representing a read of a static field invocation.
-
-
Field Details
-
identifier
private final int identifierThe represented identifier. -
field
private final boolean fieldtrue if this handle type represents a field handle.
-
-
Constructor Details
-
HandleType
private HandleType(int identifier, boolean field) Creates a new handle type.- Parameters:
identifier- The represented identifier.field- true if this handle type represents a field handle.
-
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum type has no constant with the specified nameNullPointerException- if the argument is null
-
of
protected static JavaConstant.MethodHandle.HandleType of(MethodDescription.InDefinedShape methodDescription) Extracts a handle type for invoking the given method.- Parameters:
methodDescription- The method for which a handle type should be found.- Returns:
- The handle type for the given method.
-
of
Extracts a handle type for the given identifier.- Parameters:
identifier- The identifier to extract a handle type for.- Returns:
- The representing handle type.
-
ofSpecial
protected static JavaConstant.MethodHandle.HandleType ofSpecial(MethodDescription.InDefinedShape methodDescription) Extracts a handle type for invoking the given method via invokespecial.- Parameters:
methodDescription- The method for which a handle type should be found.- Returns:
- The handle type for the given method.
-
ofGetter
protected static JavaConstant.MethodHandle.HandleType ofGetter(FieldDescription.InDefinedShape fieldDescription) Extracts a handle type for a getter of the given field.- Parameters:
fieldDescription- The field for which to create a getter handle.- Returns:
- The corresponding handle type.
-
ofSetter
protected static JavaConstant.MethodHandle.HandleType ofSetter(FieldDescription.InDefinedShape fieldDescription) Extracts a handle type for a setter of the given field.- Parameters:
fieldDescription- The field for which to create a setter handle.- Returns:
- The corresponding handle type.
-
getIdentifier
public int getIdentifier()Returns the represented identifier.- Returns:
- The represented identifier.
-
isField
public boolean isField()Returns true if this handle type represents a field handle.- Returns:
- true if this handle type represents a field handle.
-