Package serp.bytecode

Class FieldInstruction

java.lang.Object
serp.bytecode.Instruction
serp.bytecode.FieldInstruction
All Implemented Interfaces:
BCEntity, VisitAcceptor
Direct Known Subclasses:
GetFieldInstruction, PutFieldInstruction

public abstract class FieldInstruction extends Instruction
Instruction that takes as an argument a field to operate on. Examples include getfield, getstatic, setfield, setstatic.
Author:
Abe White
  • Method Details

    • getFieldIndex

      public int getFieldIndex()
      Return the index in the class ConstantPool of the ComplexEntry describing the field to operate on.
    • setFieldIndex

      public FieldInstruction setFieldIndex(int index)
      Set the index in the class ConstantPool of the ComplexEntry describing the field to operate on.
      Returns:
      this instruction, for method chaining
    • getField

      public BCField getField()
      Return the field this instruction operates on, or null if not set.
    • setField

      public FieldInstruction setField(BCField field)
      Set the field this instruction operates on.
      Returns:
      this instruction, for method chaining
    • setField

      public FieldInstruction setField(Field field)
      Set the field this instruction operates on.
      Returns:
      this instruction, for method chaining
    • setField

      public FieldInstruction setField(String dec, String name, String type)
      Set the field this instruction operates on.
      Parameters:
      dec - the full class name of the field's declaring class
      name - the field name
      type - the full class name of the field type
      Returns:
      this instruction, for method chaining
    • setField

      public FieldInstruction setField(String name, String type)
      Set the field this instruction operates on, for fields that are declared by the current class.
      Parameters:
      name - the field name
      type - the full class name of the field type
      Returns:
      this instruction, for method chaining
    • setField

      public FieldInstruction setField(Class dec, String name, Class type)
      Set the field this instruction operates on.
      Parameters:
      dec - the field's declaring class
      name - the field name
      type - the class of the field type
      Returns:
      this instruction, for method chaining
    • setField

      public FieldInstruction setField(String name, Class type)
      Set the field this instruction operates on, for fields that are declared by the current class.
      Parameters:
      name - the field name
      type - the class of the field type
      Returns:
      this instruction, for method chaining
    • setField

      public FieldInstruction setField(BCClass dec, String name, BCClass type)
      Set the field this instruction operates on.
      Parameters:
      dec - the field's declaring class
      name - the field name
      type - the class of the field type
      Returns:
      this instruction, for method chaining
    • setField

      public FieldInstruction setField(String name, BCClass type)
      Set the field this instruction operates on, for fields that are declared by the current class.
      Parameters:
      name - the field name
      type - the class of the field type
      Returns:
      this instruction, for method chaining
    • getFieldName

      public String getFieldName()
      Return the name of the field this instruction operates on, or null if not set.
    • setFieldName

      public FieldInstruction setFieldName(String name)
      Set the name of the field this instruction operates on.
      Returns:
      this instruction, for method chaining
    • getFieldTypeName

      public String getFieldTypeName()
      Return the type of the field this instruction operates on, or null if not set.
    • getFieldType

      public Class getFieldType()
      Return the type of the field this instruction operates on, or null if not set.
    • getFieldTypeBC

      public BCClass getFieldTypeBC()
      Return the type of the field this instruction operates on, or null if not set.
    • setFieldType

      public FieldInstruction setFieldType(String type)
      Set the type of the field this instruction operates on.
      Returns:
      this instruction, for method chaining
    • setFieldType

      public FieldInstruction setFieldType(Class type)
      Set the type of the field this instruction operates on.
      Returns:
      this instruction, for method chaining
    • setFieldType

      public FieldInstruction setFieldType(BCClass type)
      Set the type of the field this instruction operates on.
      Returns:
      this instruction, for method chaining
    • getFieldDeclarerName

      public String getFieldDeclarerName()
      Return the declaring class of the field this instruction operates on, or null if not set.
    • getFieldDeclarerType

      public Class getFieldDeclarerType()
      Return the declaring class of the field this instruction operates on, or null if not set.
    • getFieldDeclarerBC

      public BCClass getFieldDeclarerBC()
      Return the declaring class of the field this instruction operates on, or null if not set.
    • setFieldDeclarer

      public FieldInstruction setFieldDeclarer(String type)
      Set the declaring class of the field this instruction operates on.
      Returns:
      this instruction, for method chaining
    • setFieldDeclarer

      public FieldInstruction setFieldDeclarer(Class type)
      Set the declaring class of the field this instruction operates on.
      Returns:
      this instruction, for method chaining
    • setFieldDeclarer

      public FieldInstruction setFieldDeclarer(BCClass type)
      Set the declaring class of the field this instruction operates on.
      Returns:
      this instruction, for method chaining
    • equalsInstruction

      public boolean equalsInstruction(Instruction other)
      FieldInstructions are equal if the field they reference is the same, or if the field of either is unset.
      Overrides:
      equalsInstruction in class Instruction