Package net.bytebuddy.utility
Enum JavaConstant.MethodHandle.HandleType
- java.lang.Object
-
- java.lang.Enum<JavaConstant.MethodHandle.HandleType>
-
- net.bytebuddy.utility.JavaConstant.MethodHandle.HandleType
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<JavaConstant.MethodHandle.HandleType>
- Enclosing class:
- JavaConstant.MethodHandle
public static enum JavaConstant.MethodHandle.HandleType extends java.lang.Enum<JavaConstant.MethodHandle.HandleType>
A representation of a method handle's type.
-
-
Enum Constant Summary
Enum Constants Enum Constant Description GET_FIELD
A handle representing a read of a non-static field invocation.GET_STATIC_FIELD
A handle representing a read of a static field invocation.INVOKE_INTERFACE
A handle representing an invokeinterface invocation.INVOKE_SPECIAL
A handle representing an invokespecial invocation for a non-constructor.INVOKE_SPECIAL_CONSTRUCTOR
A handle representing an invokespecial invocation for a constructor.INVOKE_STATIC
A handle representing an invokestatic invocation.INVOKE_VIRTUAL
A handle representing an invokevirtual invocation.PUT_FIELD
A handle representing a write of a non-static field invocation.PUT_STATIC_FIELD
A handle representing a write of a static field invocation.
-
Field Summary
Fields Modifier and Type Field Description private boolean
field
true if this handle type represents a field handle.private int
identifier
The represented identifier.
-
Constructor Summary
Constructors Modifier Constructor Description private
HandleType(int identifier, boolean field)
Creates a new handle type.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getIdentifier()
Returns the represented identifier.boolean
isField()
Returns true if this handle type represents a field handle.protected static JavaConstant.MethodHandle.HandleType
of(int identifier)
Extracts a handle type for the given identifier.protected static JavaConstant.MethodHandle.HandleType
of(MethodDescription.InDefinedShape methodDescription)
Extracts a handle type for invoking the given method.protected static JavaConstant.MethodHandle.HandleType
ofGetter(FieldDescription.InDefinedShape fieldDescription)
Extracts a handle type for a getter of the given field.protected static JavaConstant.MethodHandle.HandleType
ofSetter(FieldDescription.InDefinedShape fieldDescription)
Extracts a handle type for a setter of the given field.protected static JavaConstant.MethodHandle.HandleType
ofSpecial(MethodDescription.InDefinedShape methodDescription)
Extracts a handle type for invoking the given method via invokespecial.static JavaConstant.MethodHandle.HandleType
valueOf(java.lang.String name)
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 Detail
-
INVOKE_VIRTUAL
public static final JavaConstant.MethodHandle.HandleType INVOKE_VIRTUAL
A handle representing an invokevirtual invocation.
-
INVOKE_STATIC
public static final JavaConstant.MethodHandle.HandleType INVOKE_STATIC
A handle representing an invokestatic invocation.
-
INVOKE_SPECIAL
public static final JavaConstant.MethodHandle.HandleType INVOKE_SPECIAL
A handle representing an invokespecial invocation for a non-constructor.
-
INVOKE_INTERFACE
public static final JavaConstant.MethodHandle.HandleType INVOKE_INTERFACE
A handle representing an invokeinterface invocation.
-
INVOKE_SPECIAL_CONSTRUCTOR
public static final JavaConstant.MethodHandle.HandleType INVOKE_SPECIAL_CONSTRUCTOR
A handle representing an invokespecial invocation for a constructor.
-
PUT_FIELD
public static final JavaConstant.MethodHandle.HandleType PUT_FIELD
A handle representing a write of a non-static field invocation.
-
GET_FIELD
public static final JavaConstant.MethodHandle.HandleType GET_FIELD
A handle representing a read of a non-static field invocation.
-
PUT_STATIC_FIELD
public static final JavaConstant.MethodHandle.HandleType PUT_STATIC_FIELD
A handle representing a write of a static field invocation.
-
GET_STATIC_FIELD
public static final JavaConstant.MethodHandle.HandleType GET_STATIC_FIELD
A handle representing a read of a static field invocation.
-
-
Method Detail
-
values
public static JavaConstant.MethodHandle.HandleType[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (JavaConstant.MethodHandle.HandleType c : JavaConstant.MethodHandle.HandleType.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static JavaConstant.MethodHandle.HandleType valueOf(java.lang.String name)
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:
java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- 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
protected static JavaConstant.MethodHandle.HandleType of(int identifier)
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.
-
-