com.android.dx.rop.cst
Class CstType

java.lang.Object
  extended by com.android.dx.rop.cst.Constant
      extended by com.android.dx.rop.cst.TypedConstant
          extended by com.android.dx.rop.cst.CstType
All Implemented Interfaces:
TypeBearer, ToHuman, Comparable<Constant>

public final class CstType
extends TypedConstant

Constants that represent an arbitrary type (reference or primitive).


Field Summary
static CstType BOOLEAN
          non-null; instance corresponding to the class Boolean
static CstType BOOLEAN_ARRAY
          non-null; instance corresponding to the type boolean[]
static CstType BYTE
          non-null; instance corresponding to the class Byte
static CstType BYTE_ARRAY
          non-null; instance corresponding to the type byte[]
static CstType CHAR_ARRAY
          non-null; instance corresponding to the type char[]
static CstType CHARACTER
          non-null; instance corresponding to the class Character
static CstType DOUBLE
          non-null; instance corresponding to the class Double
static CstType DOUBLE_ARRAY
          non-null; instance corresponding to the type double[]
static CstType FLOAT
          non-null; instance corresponding to the class Float
static CstType FLOAT_ARRAY
          non-null; instance corresponding to the type float[]
static CstType INT_ARRAY
          non-null; instance corresponding to the type int[]
static CstType INTEGER
          non-null; instance corresponding to the class Integer
static CstType LONG
          non-null; instance corresponding to the class Long
static CstType LONG_ARRAY
          non-null; instance corresponding to the type long[]
static CstType OBJECT
          non-null; instance corresponding to the class Object
static CstType SHORT
          non-null; instance corresponding to the class Short
static CstType SHORT_ARRAY
          non-null; instance corresponding to the type short[]
static CstType VOID
          non-null; instance corresponding to the class Void
 
Constructor Summary
CstType(Type type)
          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)
          
static CstType forBoxedPrimitiveType(Type primitiveType)
          Returns an instance of this class that represents the wrapper class corresponding to a given primitive type.
 Type getClassType()
          Gets the underlying type (as opposed to the type corresponding to this instance as a constant, which is always Class).
 CstString getDescriptor()
          Gets the type descriptor for this instance.
 Type getType()
          Gets the type associated with this instance.
 int hashCode()
          
static CstType intern(Type type)
          Returns an interned instance of this class for the given type.
 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.
 String toHuman()
          Return the "human" string form of this instance.
 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.TypedConstant
getBasicFrameType, getBasicType, getFrameType, isConstant
 
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

OBJECT

public static final CstType OBJECT
non-null; instance corresponding to the class Object


BOOLEAN

public static final CstType BOOLEAN
non-null; instance corresponding to the class Boolean


BYTE

public static final CstType BYTE
non-null; instance corresponding to the class Byte


CHARACTER

public static final CstType CHARACTER
non-null; instance corresponding to the class Character


DOUBLE

public static final CstType DOUBLE
non-null; instance corresponding to the class Double


FLOAT

public static final CstType FLOAT
non-null; instance corresponding to the class Float


LONG

public static final CstType LONG
non-null; instance corresponding to the class Long


INTEGER

public static final CstType INTEGER
non-null; instance corresponding to the class Integer


SHORT

public static final CstType SHORT
non-null; instance corresponding to the class Short


VOID

public static final CstType VOID
non-null; instance corresponding to the class Void


BOOLEAN_ARRAY

public static final CstType BOOLEAN_ARRAY
non-null; instance corresponding to the type boolean[]


BYTE_ARRAY

public static final CstType BYTE_ARRAY
non-null; instance corresponding to the type byte[]


CHAR_ARRAY

public static final CstType CHAR_ARRAY
non-null; instance corresponding to the type char[]


DOUBLE_ARRAY

public static final CstType DOUBLE_ARRAY
non-null; instance corresponding to the type double[]


FLOAT_ARRAY

public static final CstType FLOAT_ARRAY
non-null; instance corresponding to the type float[]


LONG_ARRAY

public static final CstType LONG_ARRAY
non-null; instance corresponding to the type long[]


INT_ARRAY

public static final CstType INT_ARRAY
non-null; instance corresponding to the type int[]


SHORT_ARRAY

public static final CstType SHORT_ARRAY
non-null; instance corresponding to the type short[]

Constructor Detail

CstType

public CstType(Type type)
Constructs an instance.

Parameters:
type - non-null; the underlying type
Method Detail

forBoxedPrimitiveType

public static CstType forBoxedPrimitiveType(Type primitiveType)
Returns an instance of this class that represents the wrapper class corresponding to a given primitive type. For example, if given Type.INT, this method returns the class reference java.lang.Integer.

Parameters:
primitiveType - non-null; the primitive type
Returns:
non-null; the corresponding wrapper class

intern

public static CstType intern(Type type)
Returns an interned instance of this class for the given type.

Parameters:
type - non-null; the underlying type
Returns:
non-null; an appropriately-constructed instance

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

getType

public Type getType()
Gets the type associated with this instance.

Returns:
non-null; the type

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

toHuman

public String toHuman()
Return the "human" string form of this instance. This is generally less "debuggy" than toString().

Returns:
non-null; the human string form

getClassType

public Type getClassType()
Gets the underlying type (as opposed to the type corresponding to this instance as a constant, which is always Class).

Returns:
non-null; the type corresponding to the name

getDescriptor

public CstString getDescriptor()
Gets the type descriptor for this instance.

Returns:
non-null; the descriptor


Copyright © 2013. All Rights Reserved.