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