public final class ConstantClassInfo extends CPInfo
ConstantClassInfo
denotes a CONSTANT_Class_info structure in the constant_pool of a ClassFile structure.
The CONSTANT_Class_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_Class_info structure.
|
static int |
TAG
The tag for CONSTANT_Class.
|
Modifier and Type | Method and Description |
---|---|
ConstantClassInfo |
copy()
Returns a copy of this
ConstantClassInfo instance. |
boolean |
equals(java.lang.Object object)
Returns
true if, and only if, object is an instance of ConstantClassInfo , and that ConstantClassInfo instance is equal to this ConstantClassInfo instance, false
otherwise. |
static java.util.List<ConstantClassInfo> |
filter(Node node)
Returns a
List with all ConstantClassInfo s. |
int |
getNameIndex()
Returns the name_index of this
ConstantClassInfo instance. |
int |
hashCode()
Returns a hash code for this
ConstantClassInfo instance. |
static ConstantClassInfo |
newInstance(int nameIndex)
Returns a new
ConstantClassInfo . |
void |
setNameIndex(int nameIndex)
Sets a new name_index for this
ConstantClassInfo instance. |
java.lang.String |
toString()
Returns a
String representation of this ConstantClassInfo instance. |
void |
write(java.io.DataOutput dataOutput)
Writes this
ConstantClassInfo to dataOutput . |
void |
write(Document document)
Writes this
ConstantClassInfo to document . |
getConstantPoolEntryCount, getName, getTag
public static final java.lang.String NAME
public static final int TAG
public ConstantClassInfo copy()
ConstantClassInfo
instance.public java.lang.String toString()
String
representation of this ConstantClassInfo
instance.toString
in class java.lang.Object
String
representation of this ConstantClassInfo
instancepublic boolean equals(java.lang.Object object)
true
if, and only if, object
is an instance of ConstantClassInfo
, and that ConstantClassInfo
instance is equal to this ConstantClassInfo
instance, false
otherwise.equals
in class java.lang.Object
object
- an Object
to compare to this ConstantClassInfo
instance for equalitytrue
if, and only if, object
is an instance of ConstantClassInfo
, and that ConstantClassInfo
instance is equal to this ConstantClassInfo
instance, false
otherwisepublic int getNameIndex()
ConstantClassInfo
instance.ConstantClassInfo
instancepublic int hashCode()
ConstantClassInfo
instance.hashCode
in class java.lang.Object
ConstantClassInfo
instancepublic void setNameIndex(int nameIndex)
ConstantClassInfo
instance.
If nameIndex
is less than or equal to 0
, an IllegalArgumentException
will be thrown.
nameIndex
- the new name_index for this ConstantClassInfo
instancejava.lang.IllegalArgumentException
- thrown if, and only if, nameIndex
is less than or equal to 0
public void write(java.io.DataOutput dataOutput)
ConstantClassInfo
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)
ConstantClassInfo
to document
.
If document
is null
, a NullPointerException
may be thrown. But no guarantees can be made.
public static ConstantClassInfo newInstance(int nameIndex)
ConstantClassInfo
.
If nameIndex
is less than or equal to 0
, an IllegalArgumentException
will be thrown.
nameIndex
- the name_index of the new ConstantClassInfo
instanceConstantClassInfo
java.lang.IllegalArgumentException
- thrown if, and only if, nameIndex
is less than or equal to 0
public static java.util.List<ConstantClassInfo> filter(Node node)
List
with all ConstantClassInfo
s.
All ConstantClassInfo
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 ConstantClassInfo
sjava.lang.NullPointerException
- thrown if, and only if, node
is null