Top Description Fields Constructors Methods
org.apache.bcel.classfile

public final Class ConstantNameAndType

extends Constant
Class Inheritance
Imports
java.io.DataInput, .DataOutputStream, .IOException, org.apache.bcel.Const

This class is derived from the abstract Constant and represents a reference to the name and signature of a field or method.
See Also
Constant

Field Summary

Modifier and TypeField and Description
private int
private int
Inherited from org.apache.bcel.classfile.Constant:
tag

Constructor Summary

AccessConstructor and Description
public
ConstantNameAndType(final ConstantNameAndType
Source to copy.
c
)

Initialize from another object.

pack-priv
ConstantNameAndType(final DataInput
Input stream
file
)

Initialize instance from file data.

public
ConstantNameAndType(final int
Name of field/method
nameIndex
,
final int
and its signature
signatureIndex
)

Method Summary

Modifier and TypeMethod and Description
public void
accept(final Visitor
Visitor object
v
)

Implements abstract org.apache.bcel.classfile.Constant.accept.

Implements org.apache.bcel.classfile.Node.accept.

Called by objects that are traversing the nodes of the tree implicitly defined by the contents of a Java class.
public void
dump(final DataOutputStream
Output file stream
file
)

Implements abstract org.apache.bcel.classfile.Constant.dump.

Dump name and signature index to file stream in binary format.
public String

Returns:

name
getName
(final ConstantPool cp)

public int

Returns:

Name index in constant pool of field/method name.
getNameIndex
()

public String

Returns:

signature
getSignature
(final ConstantPool cp)

public int

Returns:

Index in constant pool of field/method signature.
getSignatureIndex
()

public void
setNameIndex(final int
the name index of this constant
nameIndex
)

public void
setSignatureIndex(final int
the signature index in the constant pool of this type
signatureIndex
)

public String

Returns:

String representation
toString
()

Overrides org.apache.bcel.classfile.Constant.toString.

Returns a string representation of the object.
Inherited from org.apache.bcel.classfile.Constant:
clonecopyequalsgetComparatorgetTaghashCodereadConstantsetComparator

Field Detail

nameIndexback to summary
private int nameIndex
signatureIndexback to summary
private int signatureIndex

Constructor Detail

ConstantNameAndTypeback to summary
public ConstantNameAndType(final ConstantNameAndType c)

Initialize from another object.

Parameters
c:ConstantNameAndType

Source to copy.

ConstantNameAndTypeback to summary
pack-priv ConstantNameAndType(final DataInput file) throws IOException

Initialize instance from file data.

Parameters
file:DataInput

Input stream

Exceptions
IOException:
if an I/O error occurs.
ConstantNameAndTypeback to summary
public ConstantNameAndType(final int nameIndex, final int signatureIndex)
Parameters
nameIndex:int

Name of field/method

signatureIndex:int

and its signature

Method Detail

acceptback to summary
public void accept(final Visitor v)

Implements abstract org.apache.bcel.classfile.Constant.accept.

Implements org.apache.bcel.classfile.Node.accept.

Called by objects that are traversing the nodes of the tree implicitly defined by the contents of a Java class. I.e., the hierarchy of methods, fields, attributes, etc. spawns a tree of objects.

Parameters
v:Visitor

Visitor object

Annotations
@Override
dumpback to summary
public void dump(final DataOutputStream file) throws IOException

Implements abstract org.apache.bcel.classfile.Constant.dump.

Dump name and signature index to file stream in binary format.

Parameters
file:DataOutputStream

Output file stream

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs.
getNameback to summary
public String getName(final ConstantPool cp)
Returns:String

name

getNameIndexback to summary
public int getNameIndex()
Returns:int

Name index in constant pool of field/method name.

getSignatureback to summary
public String getSignature(final ConstantPool cp)
Returns:String

signature

getSignatureIndexback to summary
public int getSignatureIndex()
Returns:int

Index in constant pool of field/method signature.

setNameIndexback to summary
public void setNameIndex(final int nameIndex)
Parameters
nameIndex:int

the name index of this constant

setSignatureIndexback to summary
public void setSignatureIndex(final int signatureIndex)
Parameters
signatureIndex:int

the signature index in the constant pool of this type

toStringback to summary
public String toString()

Overrides org.apache.bcel.classfile.Constant.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

String representation

Annotations
@Override