FileDocCategorySizeDatePackage
FieldRefCPInfo.javaAPI DocApache Ant 1.703833Wed Dec 13 06:16:18 GMT 2006org.apache.tools.ant.taskdefs.optional.depend.constantpool

FieldRefCPInfo

public class FieldRefCPInfo extends ConstantPoolEntry
A FieldRef CP Info

Fields Summary
private String
fieldClassName
Name of the field's class
private String
fieldName
name of the field in that class
private String
fieldType
The type of the field
private int
classIndex
Index into the constant pool for the class
private int
nameAndTypeIndex
Index into the constant pool for the name and type entry
Constructors Summary
public FieldRefCPInfo()
Constructor.

        super(CONSTANT_FIELDREF, 1);
    
Methods Summary
public java.lang.StringgetFieldClassName()
Gets the name of the class defining the field

return
the name of the class defining the field

        return fieldClassName;
    
public java.lang.StringgetFieldName()
Get the name of the field

return
the field's name

        return fieldName;
    
public java.lang.StringgetFieldType()
Get the type of the field

return
the field's type in string format

        return fieldType;
    
public voidread(java.io.DataInputStream cpStream)
read a constant pool entry from a class stream.

param
cpStream the DataInputStream which contains the constant pool entry to be read.
exception
IOException if there is a problem reading the entry from the stream.

        classIndex = cpStream.readUnsignedShort();
        nameAndTypeIndex = cpStream.readUnsignedShort();
    
public voidresolve(ConstantPool constantPool)
Resolve this constant pool entry with respect to its dependents in the constant pool.

param
constantPool the constant pool of which this entry is a member and against which this entry is to be resolved.

        ClassCPInfo fieldClass
            = (ClassCPInfo) constantPool.getEntry(classIndex);

        fieldClass.resolve(constantPool);

        fieldClassName = fieldClass.getClassName();

        NameAndTypeCPInfo nt
            = (NameAndTypeCPInfo) constantPool.getEntry(nameAndTypeIndex);

        nt.resolve(constantPool);

        fieldName = nt.getName();
        fieldType = nt.getType();

        super.resolve(constantPool);
    
public java.lang.StringtoString()
Print a readable version of the constant pool entry.

return
the string representation of this constant pool entry.

        String value;

        if (isResolved()) {
            value = "Field : Class = " + fieldClassName + ", name = "
                + fieldName + ", type = " + fieldType;
        } else {
            value = "Field : Class index = " + classIndex
                + ", name and type index = " + nameAndTypeIndex;
        }

        return value;