Class CstNat

java.lang.Object
com.android.dx.rop.cst.Constant
com.android.dx.rop.cst.CstNat
All Implemented Interfaces:
ToHuman, Comparable<Constant>

public final class CstNat extends Constant
Constants of type CONSTANT_NameAndType_info.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final CstNat
    non-null; the instance for name TYPE and descriptor java.lang.Class, which is useful when dealing with wrapped primitives
  • Constructor Summary

    Constructors
    Constructor
    Description
    CstNat(CstString name, CstString descriptor)
    Constructs an instance.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected int
    Compare the values of this and another instance, which are guaranteed to be of the same class.
    boolean
    equals(Object other)
    Gets the descriptor.
    Gets the field type corresponding to this instance's descriptor.
    Gets the name.
    int
    boolean
    Returns true if this instance is a category-2 constant, meaning it takes up two slots in the constant pool, or false if this instance is category-1.
    final boolean
    Gets whether this instance has the name of a standard class initialization method.
    final boolean
    Gets whether this instance has the name of a standard instance initialization method.
    Returns an unadorned but human-readable version of the name-and-type value.
    Returns the human name for the particular type of constant this instance is.

    Methods inherited from class com.android.dx.rop.cst.Constant

    compareTo

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • PRIMITIVE_TYPE_NAT

      public static final CstNat PRIMITIVE_TYPE_NAT
      non-null; the instance for name TYPE and descriptor java.lang.Class, which is useful when dealing with wrapped primitives
  • Constructor Details

    • CstNat

      public CstNat(CstString name, CstString descriptor)
      Constructs an instance.
      Parameters:
      name - non-null; the name
      descriptor - non-null; the descriptor
  • Method Details

    • equals

      public boolean equals(Object other)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • 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.
      Specified by:
      compareTo0 in class Constant
      Parameters:
      other - non-null; the instance to compare to
      Returns:
      -1, 0, or 1, as usual for a comparison
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • 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
    • isCategory2

      public boolean isCategory2()
      Returns true if this instance is a category-2 constant, meaning it takes up two slots in the constant pool, or false if this instance is category-1.
      Specified by:
      isCategory2 in class Constant
      Returns:
      true iff this instance is category-2
    • getName

      public CstString getName()
      Gets the name.
      Returns:
      non-null; the name
    • getDescriptor

      public CstString getDescriptor()
      Gets the descriptor.
      Returns:
      non-null; the descriptor
    • toHuman

      public String toHuman()
      Returns an unadorned but human-readable version of the name-and-type value.
      Returns:
      non-null; the human form
    • getFieldType

      public Type getFieldType()
      Gets the field type corresponding to this instance's descriptor. This method is only valid to call if the descriptor in fact describes a field (and not a method).
      Returns:
      non-null; the field type
    • isInstanceInit

      public final boolean isInstanceInit()
      Gets whether this instance has the name of a standard instance initialization method. This is just a convenient shorthand for getName().getString().equals("<init>").
      Returns:
      true iff this is a reference to an instance initialization method
    • isClassInit

      public final boolean isClassInit()
      Gets whether this instance has the name of a standard class initialization method. This is just a convenient shorthand for getName().getString().equals("<clinit>").
      Returns:
      true iff this is a reference to an instance initialization method