Enum FieldAccess
- java.lang.Object
-
- java.lang.Enum<FieldAccess>
-
- net.bytebuddy.implementation.bytecode.member.FieldAccess
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<FieldAccess>
public enum FieldAccess extends java.lang.Enum<FieldAccess>
An access representation to a given field.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
FieldAccess.AccessDispatcher
A dispatcher for implementing a non-generic read or write access on a field.static interface
FieldAccess.Defined
Representation of a field access for which a getter and a setter can be created.protected static class
FieldAccess.OfGenericField
A dispatcher for implementing a generic read or write access on a field.
-
Field Summary
Fields Modifier and Type Field Description private int
getterOpcode
The opcode for getting a field value.private int
putterOpcode
The opcode for setting a field value.private int
targetSizeChange
The amount of operand slots this field access operation consumes when it is applied before eventually adding new values onto the operand stack.
-
Constructor Summary
Constructors Modifier Constructor Description private
FieldAccess(int putterOpcode, int getterOpcode, StackSize targetSizeChange)
Creates a new field access.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StackManipulation
forEnumeration(EnumerationDescription enumerationDescription)
Creates an accessor to read an enumeration value.static FieldAccess.Defined
forField(FieldDescription fieldDescription)
Creates a field access representation for a given field.static FieldAccess.Defined
forField(FieldDescription.InDefinedShape fieldDescription)
Creates a field access representation for a given field.static FieldAccess
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.static FieldAccess[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
STATIC
public static final FieldAccess STATIC
The representation of field access to a static field.
-
INSTANCE
public static final FieldAccess INSTANCE
The representation of field access to an instance field.
-
-
Field Detail
-
putterOpcode
private final int putterOpcode
The opcode for setting a field value.
-
getterOpcode
private final int getterOpcode
The opcode for getting a field value.
-
targetSizeChange
private final int targetSizeChange
The amount of operand slots this field access operation consumes when it is applied before eventually adding new values onto the operand stack.
-
-
Constructor Detail
-
FieldAccess
private FieldAccess(int putterOpcode, int getterOpcode, StackSize targetSizeChange)
Creates a new field access.- Parameters:
putterOpcode
- The opcode for setting a field value.getterOpcode
- The opcode for getting a field value.targetSizeChange
- The amount of operand slots this field access operation consumes when it is applied before eventually adding new values onto the operand stack.
-
-
Method Detail
-
values
public static FieldAccess[] 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 (FieldAccess c : FieldAccess.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static FieldAccess 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
-
forEnumeration
public static StackManipulation forEnumeration(EnumerationDescription enumerationDescription)
Creates an accessor to read an enumeration value.- Parameters:
enumerationDescription
- The description of the enumeration.- Returns:
- A stack manipulation for reading the enumeration.
-
forField
public static FieldAccess.Defined forField(FieldDescription.InDefinedShape fieldDescription)
Creates a field access representation for a given field.- Parameters:
fieldDescription
- The field to be accessed.- Returns:
- A field access definition for the given field.
-
forField
public static FieldAccess.Defined forField(FieldDescription fieldDescription)
Creates a field access representation for a given field. If the field's return type derives from its declared shape, the value is additionally casted to the generically resolved field.- Parameters:
fieldDescription
- The field to be accessed.- Returns:
- A field access definition for the given field.
-
-