FileDocCategorySizeDatePackage
ConstantNameAndType.javaAPI DocJava SE 5 API5829Fri Aug 26 14:55:16 BST 2005com.sun.org.apache.bcel.internal.classfile

ConstantNameAndType

public final class ConstantNameAndType extends Constant
This class is derived from the abstract Constant class and represents a reference to the name and signature of a field or method.
version
$Id: ConstantNameAndType.java,v 1.1.1.1 2001/10/29 19:59:59 jvanzyl Exp $
author
M. Dahm
see
Constant

Fields Summary
private int
name_index
private int
signature_index
Constructors Summary
public ConstantNameAndType(ConstantNameAndType c)
Initialize from another object.

    this(c.getNameIndex(), c.getSignatureIndex());
  
ConstantNameAndType(DataInputStream file)
Initialize instance from file data.

param
file Input stream
throw
IOException

    
    this((int)file.readUnsignedShort(), (int)file.readUnsignedShort());
  
public ConstantNameAndType(int name_index, int signature_index)

param
name_index Name of field/method
param
signature_index and its signature

    super(Constants.CONSTANT_NameAndType);
    this.name_index      = name_index;
    this.signature_index = signature_index;
  
Methods Summary
public voidaccept(com.sun.org.apache.bcel.internal.classfile.Visitor v)
Called by objects that are traversing the nodes of the tree implicitely defined by the contents of a Java class. I.e., the hierarchy of methods, fields, attributes, etc. spawns a tree of objects.

param
v Visitor object

    v.visitConstantNameAndType(this);
  
public final voiddump(java.io.DataOutputStream file)
Dump name and signature index to file stream in binary format.

param
file Output file stream
throw
IOException

    file.writeByte(tag);
    file.writeShort(name_index);
    file.writeShort(signature_index);
  
public final java.lang.StringgetName(com.sun.org.apache.bcel.internal.classfile.ConstantPool cp)

return
name

    return cp.constantToString(getNameIndex(), Constants.CONSTANT_Utf8);
  
public final intgetNameIndex()

return
Name index in constant pool of field/method name.

 return name_index; 
public final java.lang.StringgetSignature(com.sun.org.apache.bcel.internal.classfile.ConstantPool cp)

return
signature

    return cp.constantToString(getSignatureIndex(), Constants.CONSTANT_Utf8);
  
public final intgetSignatureIndex()

return
Index in constant pool of field/method signature.

 return signature_index; 
public final voidsetNameIndex(int name_index)

param
name_index.

    this.name_index = name_index;
  
public final voidsetSignatureIndex(int signature_index)

param
signature_index.

    this.signature_index = signature_index;
  
public final java.lang.StringtoString()

return
String representation

    return super.toString() + "(name_index = " + name_index + 
      ", signature_index = " + signature_index + ")";