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