FileDocCategorySizeDatePackage
ConstantObject.javaAPI DocJ2ME CLDC 1.13028Wed Feb 05 15:56:02 GMT 2003components

ConstantObject

public abstract class ConstantObject extends ClassComponent implements Cloneable

Fields Summary
public int
references
public int
ldcReferences
public boolean
shared
public ConstantPool
containingPool
public int
index
public int
tag
public int
nSlots
Constructors Summary
Methods Summary
public voidclearReference()

    references = 0;
    
public voidclearldcReference()

        ldcReferences = 0;
    
public java.lang.Objectclone()

    ConstantObject newC;
    try {
        newC = (ConstantObject)super.clone();
        newC.references = 0;
        newC.shared     = false;
        newC.index      = 0;
        return newC;
    } catch( CloneNotSupportedException e ){
        e.printStackTrace();
        System.exit(1);
    }
    return null;
    
public voiddecReference()

    references--;
    
public voiddecldcReference()

        ldcReferences--;
    
public voidincReference()

    references++;
    
public voidincldcReference()


       
        ldcReferences++;
    
public abstract booleanisResolved()

public static components.ConstantObjectreadObject(java.io.DataInput i)

    // read the tag and dispatch accordingly
    int tag = i.readUnsignedByte();
    switch( tag ){
    case Const.CONSTANT_UTF8:
        return UnicodeConstant.read( tag, i );
    case Const.CONSTANT_INTEGER:
    case Const.CONSTANT_FLOAT:
        return SingleValueConstant.read( tag, i );
    case Const.CONSTANT_DOUBLE:
    case Const.CONSTANT_LONG:
        return DoubleValueConstant.read( tag, i );
    case Const.CONSTANT_STRING:
        return StringConstant.read( tag, i );
    case Const.CONSTANT_NAMEANDTYPE:
        return NameAndTypeConstant.read( tag, i );
    case Const.CONSTANT_CLASS:
        return ClassConstant.read( tag, i );
    case Const.CONSTANT_FIELD:
        return FieldConstant.read( tag, i );
    case Const.CONSTANT_METHOD:
        return MethodConstant.read( tag, i );
    case Const.CONSTANT_INTERFACEMETHOD:
        return InterfaceConstant.read( tag, i );
    default:
        throw new DataFormatException("Format error (constant tag "+tag+" )");
    }