Enum MethodInvocation
- java.lang.Object
-
- java.lang.Enum<MethodInvocation>
-
- net.bytebuddy.implementation.bytecode.member.MethodInvocation
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<MethodInvocation>
public enum MethodInvocation extends java.lang.Enum<MethodInvocation>
A builder for a method invocation.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
MethodInvocation.DynamicInvocation
Performs a dynamic method invocation of the given method.protected static class
MethodInvocation.HandleInvocation
Performs a method invocation on a method handle with a polymorphic type signature.static class
MethodInvocation.HandleType
The type of method handle invocation.protected static class
MethodInvocation.IllegalInvocation
An illegal implicit method invocation.protected class
MethodInvocation.Invocation
An implementation of a method invoking stack manipulation.protected static class
MethodInvocation.OfGenericMethod
A method invocation of a generically resolved method.static interface
MethodInvocation.WithImplicitInvocationTargetType
Represents a method invocation where the invocation type (static, virtual, special, interface) is derived from the given method's description.
-
Enum Constant Summary
Enum Constants Enum Constant Description INTERFACE
An interface-typed virtual method invocation.INTERFACE_PRIVATE
A private method call that is potentially virtual on an interface type.SPECIAL
A specialized pseudo-virtual method invocation for a non-constructor.SPECIAL_CONSTRUCTOR
A specialized pseudo-virtual method invocation for a constructor.STATIC
A static method invocation.VIRTUAL
A virtual method invocation.VIRTUAL_PRIVATE
A private method call that is potentially virtual.
-
Field Summary
Fields Modifier and Type Field Description private int
handle
The handle being used for a dynamic method invocation.private int
legacyHandle
The handle being used for a dynamic method invocation before Java 11.private int
legacyOpcode
The opcode for invoking a method before Java 11.private int
opcode
The opcode for invoking a method.
-
Constructor Summary
Constructors Modifier Constructor Description private
MethodInvocation(int opcode, int handle, int legacyOpcode, int legacyHandle)
Creates a new type of method invocation.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static MethodInvocation.WithImplicitInvocationTargetType
invoke(MethodDescription methodDescription)
Creates a method invocation with an implicitly determined invocation type.static MethodInvocation.WithImplicitInvocationTargetType
invoke(MethodDescription.InDefinedShape methodDescription)
Creates a method invocation with an implicitly determined invocation type.static MethodInvocation
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.static MethodInvocation[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
VIRTUAL
public static final MethodInvocation VIRTUAL
A virtual method invocation.
-
INTERFACE
public static final MethodInvocation INTERFACE
An interface-typed virtual method invocation.
-
STATIC
public static final MethodInvocation STATIC
A static method invocation.
-
SPECIAL
public static final MethodInvocation SPECIAL
A specialized pseudo-virtual method invocation for a non-constructor.
-
SPECIAL_CONSTRUCTOR
public static final MethodInvocation SPECIAL_CONSTRUCTOR
A specialized pseudo-virtual method invocation for a constructor.
-
VIRTUAL_PRIVATE
public static final MethodInvocation VIRTUAL_PRIVATE
A private method call that is potentially virtual.
-
INTERFACE_PRIVATE
public static final MethodInvocation INTERFACE_PRIVATE
A private method call that is potentially virtual on an interface type.
-
-
Field Detail
-
opcode
private final int opcode
The opcode for invoking a method.
-
handle
private final int handle
The handle being used for a dynamic method invocation.
-
legacyOpcode
private final int legacyOpcode
The opcode for invoking a method before Java 11.
-
legacyHandle
private final int legacyHandle
The handle being used for a dynamic method invocation before Java 11.
-
-
Constructor Detail
-
MethodInvocation
private MethodInvocation(int opcode, int handle, int legacyOpcode, int legacyHandle)
Creates a new type of method invocation.- Parameters:
opcode
- The opcode for invoking a method.handle
- The handle being used for a dynamic method invocation.legacyOpcode
- The opcode for invoking a method before Java 11.legacyHandle
- The handle being used for a dynamic method invocation before Java 11.
-
-
Method Detail
-
values
public static MethodInvocation[] 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 (MethodInvocation c : MethodInvocation.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static MethodInvocation 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
-
invoke
public static MethodInvocation.WithImplicitInvocationTargetType invoke(MethodDescription.InDefinedShape methodDescription)
Creates a method invocation with an implicitly determined invocation type.- Parameters:
methodDescription
- The method to be invoked.- Returns:
- A stack manipulation with implicitly determined invocation type.
-
invoke
public static MethodInvocation.WithImplicitInvocationTargetType invoke(MethodDescription methodDescription)
Creates a method invocation with an implicitly determined invocation type. If the method's return type derives from its declared shape, the value is additionally casted to the value of the generically resolved method.- Parameters:
methodDescription
- The method to be invoked.- Returns:
- A stack manipulation with implicitly determined invocation type.
-
-