public final class ConstantNameAndTypeInfo extends CPInfo
ConstantNameAndTypeInfo
denotes a CONSTANT_NameAndType_info structure in the constant_pool of a ClassFile structure.
The CONSTANT_NameAndType_info structure was added to Java in version 1.0.2.
This class is not thread-safe.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
NAME
The name of the CONSTANT_NameAndType_info structure.
|
static int |
TAG
The tag for CONSTANT_NameAndType.
|
Modifier and Type | Method and Description |
---|---|
ConstantNameAndTypeInfo |
copy()
Returns a copy of this
ConstantNameAndTypeInfo instance. |
boolean |
equals(java.lang.Object object)
Returns
true if, and only if, object is an instance of ConstantNameAndTypeInfo , and that ConstantNameAndTypeInfo instance is equal to this ConstantNameAndTypeInfo instance,
false otherwise. |
static java.util.List<ConstantNameAndTypeInfo> |
filter(Node node)
Returns a
List with all ConstantNameAndTypeInfo s. |
int |
getDescriptorIndex()
Returns the descriptor_index of this
ConstantNameAndTypeInfo instance. |
int |
getNameIndex()
Returns the name_index of this
ConstantNameAndTypeInfo instance. |
int |
hashCode()
Returns a hash code for this
ConstantNameAndTypeInfo instance. |
static ConstantNameAndTypeInfo |
newInstance(int nameIndex,
int descriptorIndex)
Returns a new
ConstantNameAndTypeInfo . |
void |
setDescriptorIndex(int descriptorIndex)
Sets a new descriptor_index for this
ConstantNameAndTypeInfo instance. |
void |
setNameIndex(int nameIndex)
Sets a new name_index for this
ConstantNameAndTypeInfo instance. |
java.lang.String |
toString()
Returns a
String representation of this ConstantNameAndTypeInfo instance. |
void |
write(java.io.DataOutput dataOutput)
Writes this
ConstantNameAndTypeInfo to dataOutput . |
void |
write(Document document)
Writes this
ConstantNameAndTypeInfo to document . |
getConstantPoolEntryCount, getName, getTag
public static final java.lang.String NAME
public static final int TAG
public ConstantNameAndTypeInfo copy()
ConstantNameAndTypeInfo
instance.public java.lang.String toString()
String
representation of this ConstantNameAndTypeInfo
instance.toString
in class java.lang.Object
String
representation of this ConstantNameAndTypeInfo
instancepublic boolean equals(java.lang.Object object)
true
if, and only if, object
is an instance of ConstantNameAndTypeInfo
, and that ConstantNameAndTypeInfo
instance is equal to this ConstantNameAndTypeInfo
instance,
false
otherwise.equals
in class java.lang.Object
object
- an Object
to compare to this ConstantNameAndTypeInfo
instance for equalitytrue
if, and only if, object
is an instance of ConstantNameAndTypeInfo
, and that ConstantNameAndTypeInfo
instance is equal to this ConstantNameAndTypeInfo
instance,
false
otherwisepublic int getDescriptorIndex()
ConstantNameAndTypeInfo
instance.ConstantNameAndTypeInfo
instancepublic int getNameIndex()
ConstantNameAndTypeInfo
instance.ConstantNameAndTypeInfo
instancepublic int hashCode()
ConstantNameAndTypeInfo
instance.hashCode
in class java.lang.Object
ConstantNameAndTypeInfo
instancepublic void setDescriptorIndex(int descriptorIndex)
ConstantNameAndTypeInfo
instance.
If descriptorIndex
is less than or equal to 0
, an IllegalArgumentException
will be thrown.
descriptorIndex
- the new descriptor_index for this ConstantNameAndTypeInfo
instancejava.lang.IllegalArgumentException
- thrown if, and only if, descriptorIndex
is less than or equal to 0
public void setNameIndex(int nameIndex)
ConstantNameAndTypeInfo
instance.
If nameIndex
is less than or equal to 0
, an IllegalArgumentException
will be thrown.
nameIndex
- the new name_index for this ConstantNameAndTypeInfo
instancejava.lang.IllegalArgumentException
- thrown if, and only if, nameIndex
is less than or equal to 0
public void write(java.io.DataOutput dataOutput)
ConstantNameAndTypeInfo
to dataOutput
.
If dataOutput
is an OutputStream
(or any other type of stream), this method will not close it.
If dataOutput
is null
, a NullPointerException
will be thrown.
If an I/O-error occurs, an UncheckedIOException
will be thrown.
public void write(Document document)
ConstantNameAndTypeInfo
to document
.
If document
is null
, a NullPointerException
may be thrown. But no guarantees can be made.
public static ConstantNameAndTypeInfo newInstance(int nameIndex, int descriptorIndex)
ConstantNameAndTypeInfo
.
If either nameIndex
or descriptorIndex
are less than or equal to 0
, an IllegalArgumentException
will be thrown.
nameIndex
- the name_index of the new ConstantNameAndTypeInfo
instancedescriptorIndex
- the descriptor_index of the new ConstantNameAndTypeInfo
instanceConstantNameAndTypeInfo
java.lang.IllegalArgumentException
- thrown if, and only if, either nameIndex
or descriptorIndex
are less than or equal to 0
public static java.util.List<ConstantNameAndTypeInfo> filter(Node node)
List
with all ConstantNameAndTypeInfo
s.
All ConstantNameAndTypeInfo
s are found by traversing node
using a simple NodeHierarchicalVisitor
implementation.
If node
is null
, a NullPointerException
will be thrown.
node
- the Node
to start traversal fromList
with all ConstantNameAndTypeInfo
sjava.lang.NullPointerException
- thrown if, and only if, node
is null