Class CstFieldRef

All Implemented Interfaces:
TypeBearer, ToHuman, Comparable<Constant>

public final class CstFieldRef extends CstMemberRef
Constants of type CONSTANT_Fieldref_info.
  • Constructor Details

    • CstFieldRef

      public CstFieldRef(CstType definingClass, CstNat nat)
      Constructs an instance.
      Parameters:
      definingClass - non-null; the type of the defining class
      nat - non-null; the name-and-type
  • Method Details

    • forPrimitiveType

      public static CstFieldRef forPrimitiveType(Type primitiveType)
      Returns an instance of this class that represents the static field which should hold the class corresponding to a given primitive type. For example, if given Type.INT, this method returns an instance corresponding to the field java.lang.Integer.TYPE.
      Parameters:
      primitiveType - non-null; the primitive type
      Returns:
      non-null; the corresponding static field
    • typeName

      public String typeName()
      Returns the human name for the particular type of constant this instance is.
      Specified by:
      typeName in class Constant
      Returns:
      non-null; the name
    • getType

      public Type getType()
      Returns the type of this field.
      Returns:
      non-null; the field's type
    • compareTo0

      protected int compareTo0(Constant other)
      Compare the values of this and another instance, which are guaranteed to be of the same class. Subclasses must implement this.

      Note: This implementation just compares the defining class and name, and it is up to subclasses to compare the rest after calling super.compareTo0().

      Overrides:
      compareTo0 in class CstMemberRef
      Parameters:
      other - non-null; the instance to compare to
      Returns:
      -1, 0, or 1, as usual for a comparison