com.android.dx.rop.cst
Class CstNat

java.lang.Object
  extended by com.android.dx.rop.cst.Constant
      extended by 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
static 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 Summary
CstNat(CstString name, CstString descriptor)
          Constructs an instance.
 
Method Summary
protected  int compareTo0(Constant other)
          Compare the values of this and another instance, which are guaranteed to be of the same class.
 boolean equals(Object other)
          
 CstString getDescriptor()
          Gets the descriptor.
 Type getFieldType()
          Gets the field type corresponding to this instance's descriptor.
 CstString getName()
          Gets the name.
 int hashCode()
          
 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.
 boolean isClassInit()
          Gets whether this instance has the name of a standard class initialization method.
 boolean isInstanceInit()
          Gets whether this instance has the name of a standard instance initialization method.
 String toHuman()
          Returns an unadorned but human-readable version of the name-and-type value.
 String toString()
          
 String typeName()
          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 Detail

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 Detail

CstNat

public CstNat(CstString name,
              CstString descriptor)
Constructs an instance.

Parameters:
name - non-null; the name
descriptor - non-null; the descriptor
Method Detail

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


Copyright © 2015. All rights reserved.