FileDocCategorySizeDatePackage
CstType.javaAPI DocAndroid 5.1 API7950Thu Mar 12 22:18:30 GMT 2015com.android.dexgen.rop.cst

CstType

public final class CstType extends TypedConstant
Constants that represent an arbitrary type (reference or primitive).

Fields Summary
private static final HashMap
interns
{@code non-null;} map of interned types
public static final CstType
OBJECT
{@code non-null;} instance corresponding to the class {@code Object}
public static final CstType
BOOLEAN
{@code non-null;} instance corresponding to the class {@code Boolean}
public static final CstType
BYTE
{@code non-null;} instance corresponding to the class {@code Byte}
public static final CstType
CHARACTER
{@code non-null;} instance corresponding to the class {@code Character}
public static final CstType
DOUBLE
{@code non-null;} instance corresponding to the class {@code Double}
public static final CstType
FLOAT
{@code non-null;} instance corresponding to the class {@code Float}
public static final CstType
LONG
{@code non-null;} instance corresponding to the class {@code Long}
public static final CstType
INTEGER
{@code non-null;} instance corresponding to the class {@code Integer}
public static final CstType
SHORT
{@code non-null;} instance corresponding to the class {@code Short}
public static final CstType
VOID
{@code non-null;} instance corresponding to the class {@code Void}
public static final CstType
BOOLEAN_ARRAY
{@code non-null;} instance corresponding to the type {@code boolean[]}
public static final CstType
BYTE_ARRAY
{@code non-null;} instance corresponding to the type {@code byte[]}
public static final CstType
CHAR_ARRAY
{@code non-null;} instance corresponding to the type {@code char[]}
public static final CstType
DOUBLE_ARRAY
{@code non-null;} instance corresponding to the type {@code double[]}
public static final CstType
FLOAT_ARRAY
{@code non-null;} instance corresponding to the type {@code float[]}
public static final CstType
LONG_ARRAY
{@code non-null;} instance corresponding to the type {@code long[]}
public static final CstType
INT_ARRAY
{@code non-null;} instance corresponding to the type {@code int[]}
public static final CstType
SHORT_ARRAY
{@code non-null;} instance corresponding to the type {@code short[]}
private final com.android.dexgen.rop.type.Type
type
{@code non-null;} the underlying type
private CstUtf8
descriptor
{@code null-ok;} the type descriptor corresponding to this instance, if calculated
Constructors Summary
public CstType(com.android.dexgen.rop.type.Type type)
Constructs an instance.

param
type {@code non-null;} the underlying type

        if (type == null) {
            throw new NullPointerException("type == null");
        }

        if (type == type.KNOWN_NULL) {
            throw new UnsupportedOperationException(
                    "KNOWN_NULL is not representable");
        }

        this.type = type;
        this.descriptor = null;
    
Methods Summary
protected intcompareTo0(Constant other)
{@inheritDoc}

        String thisDescriptor = type.getDescriptor();
        String otherDescriptor = ((CstType) other).type.getDescriptor();
        return thisDescriptor.compareTo(otherDescriptor);
    
public booleanequals(java.lang.Object other)
{@inheritDoc}

        if (!(other instanceof CstType)) {
            return false;
        }

        return type == ((CstType) other).type;
    
public static com.android.dexgen.rop.cst.CstTypeforBoxedPrimitiveType(com.android.dexgen.rop.type.Type primitiveType)
Returns an instance of this class that represents the wrapper class corresponding to a given primitive type. For example, if given {@link Type#INT}, this method returns the class reference {@code java.lang.Integer}.

param
primitiveType {@code non-null;} the primitive type
return
{@code non-null;} the corresponding wrapper class


                                                      
         
        switch (primitiveType.getBasicType()) {
            case Type.BT_BOOLEAN: return BOOLEAN;
            case Type.BT_BYTE:    return BYTE;
            case Type.BT_CHAR:    return CHARACTER;
            case Type.BT_DOUBLE:  return DOUBLE;
            case Type.BT_FLOAT:   return FLOAT;
            case Type.BT_INT:     return INTEGER;
            case Type.BT_LONG:    return LONG;
            case Type.BT_SHORT:   return SHORT;
            case Type.BT_VOID:    return VOID;
        }

        throw new IllegalArgumentException("not primitive: " + primitiveType);
    
public com.android.dexgen.rop.type.TypegetClassType()
Gets the underlying type (as opposed to the type corresponding to this instance as a constant, which is always {@code Class}).

return
{@code non-null;} the type corresponding to the name

        return type;
    
public CstUtf8getDescriptor()
Gets the type descriptor for this instance.

return
{@code non-null;} the descriptor

        if (descriptor == null) {
            descriptor = new CstUtf8(type.getDescriptor());
        }

        return descriptor;
    
public com.android.dexgen.rop.type.TypegetType()
{@inheritDoc}

        return Type.CLASS;
    
public inthashCode()
{@inheritDoc}

        return type.hashCode();
    
public static com.android.dexgen.rop.cst.CstTypeintern(com.android.dexgen.rop.type.Type type)
Returns an interned instance of this class for the given type.

param
type {@code non-null;} the underlying type
return
{@code non-null;} an appropriately-constructed instance

        CstType cst = interns.get(type);

        if (cst == null) {
            cst = new CstType(type);
            interns.put(type, cst);
        }

        return cst;
    
public static com.android.dexgen.rop.cst.CstTypeintern(java.lang.Class clazz)
Returns an interned instance of this class for the given {@code Class} instance.

param
clazz {@code non-null;} the underlying {@code Class} object
return
{@code non-null;} an appropriately-constructed instance

        return intern(Type.intern(clazz));
    
public booleanisCategory2()
{@inheritDoc}

        return false;
    
public java.lang.StringtoHuman()
{@inheritDoc}

        return type.toHuman();
    
public java.lang.StringtoString()
{@inheritDoc}

        return "type{" + toHuman() + '}";
    
public java.lang.StringtypeName()
{@inheritDoc}

        return "type";