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