public final class MethodParametersAttribute extends AttributeInfo
MethodParametersAttribute
denotes a MethodParameters_attribute structure somewhere in a ClassFile structure.
This class is not thread-safe.
Modifier and Type | Class and Description |
---|---|
static class |
MethodParametersAttribute.Parameter
A
Parameter that can be found as a part of any MethodParametersAttribute instances. |
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
NAME
The name of the MethodParameters_attribute structure.
|
Modifier and Type | Method and Description |
---|---|
boolean |
accept(NodeHierarchicalVisitor nodeHierarchicalVisitor)
Accepts a
NodeHierarchicalVisitor . |
void |
addParameter(MethodParametersAttribute.Parameter parameter)
Adds
parameter to this MethodParametersAttribute instance. |
MethodParametersAttribute |
copy()
Returns a copy of this
MethodParametersAttribute instance. |
boolean |
equals(java.lang.Object object)
Returns
true if, and only if, object is an instance of MethodParametersAttribute , and that MethodParametersAttribute instance is equal to this MethodParametersAttribute
instance, false otherwise. |
static java.util.List<MethodParametersAttribute> |
filter(Node node)
Returns a
List with all MethodParametersAttribute s. |
static java.util.Optional<MethodParametersAttribute> |
find(MethodInfo methodInfo)
Attempts to find a
MethodParametersAttribute instance in methodInfo . |
int |
getAttributeLength()
Returns the attribute_length of this
MethodParametersAttribute instance. |
java.util.List<MethodParametersAttribute.Parameter> |
getParameters()
Returns a
List with all currently added Parameter s. |
int |
getParametersCount()
Returns the parameters_count of this
MethodParametersAttribute instance. |
int |
hashCode()
Returns a hash code for this
MethodParametersAttribute instance. |
static MethodParametersAttribute |
newInstance(int attributeNameIndex)
Returns a new
MethodParametersAttribute instance. |
void |
removeParameter(MethodParametersAttribute.Parameter parameter)
Removes
parameter from this MethodParametersAttribute instance. |
java.lang.String |
toString()
Returns a
String representation of this MethodParametersAttribute instance. |
void |
write(java.io.DataOutput dataOutput)
Writes this
MethodParametersAttribute to dataOutput . |
getAttributeNameIndex, getName, setAttributeNameIndex
public static final java.lang.String NAME
public java.util.List<MethodParametersAttribute.Parameter> getParameters()
List
with all currently added Parameter
s.
Modifying the returned List
will not affect this MethodParametersAttribute
instance.
List
with all currently added Parameter
spublic MethodParametersAttribute copy()
MethodParametersAttribute
instance.copy
in class AttributeInfo
MethodParametersAttribute
instancepublic java.lang.String toString()
String
representation of this MethodParametersAttribute
instance.toString
in class java.lang.Object
String
representation of this MethodParametersAttribute
instancepublic boolean accept(NodeHierarchicalVisitor nodeHierarchicalVisitor)
NodeHierarchicalVisitor
.
Returns the result of nodeHierarchicalVisitor.visitLeave(this)
.
If nodeHierarchicalVisitor
is null
, a NullPointerException
will be thrown.
If a RuntimeException
is thrown by the current NodeHierarchicalVisitor
, a NodeTraversalException
will be thrown with the RuntimeException
wrapped.
This implementation will:
NullPointerException
if nodeHierarchicalVisitor
is null
.NodeTraversalException
if nodeHierarchicalVisitor
throws a RuntimeException
.Node
s, if it has any.nodeHierarchicalVisitor
- the NodeHierarchicalVisitor
to acceptnodeHierarchicalVisitor.visitLeave(this)
NodeTraversalException
- thrown if, and only if, a RuntimeException
is thrown by the current NodeHierarchicalVisitor
java.lang.NullPointerException
- thrown if, and only if, nodeHierarchicalVisitor
is null
public boolean equals(java.lang.Object object)
true
if, and only if, object
is an instance of MethodParametersAttribute
, and that MethodParametersAttribute
instance is equal to this MethodParametersAttribute
instance, false
otherwise.equals
in class java.lang.Object
object
- an Object
to compare to this MethodParametersAttribute
instance for equalitytrue
if, and only if, object
is an instance of MethodParametersAttribute
, and that MethodParametersAttribute
instance is equal to this MethodParametersAttribute
instance, false
otherwisepublic int getAttributeLength()
MethodParametersAttribute
instance.getAttributeLength
in class AttributeInfo
MethodParametersAttribute
instancepublic int getParametersCount()
MethodParametersAttribute
instance.MethodParametersAttribute
instancepublic int hashCode()
MethodParametersAttribute
instance.hashCode
in class java.lang.Object
MethodParametersAttribute
instancepublic void addParameter(MethodParametersAttribute.Parameter parameter)
parameter
to this MethodParametersAttribute
instance.
If parameter
is null
, a NullPointerException
will be thrown.
parameter
- the Parameter
to addjava.lang.NullPointerException
- thrown if, and only if, parameter
is null
public void removeParameter(MethodParametersAttribute.Parameter parameter)
parameter
from this MethodParametersAttribute
instance.
If parameter
is null
, a NullPointerException
will be thrown.
parameter
- the Parameter
to removejava.lang.NullPointerException
- thrown if, and only if, parameter
is null
public void write(java.io.DataOutput dataOutput)
MethodParametersAttribute
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.
write
in class AttributeInfo
dataOutput
- the DataOutput
to write tojava.lang.NullPointerException
- thrown if, and only if, dataOutput
is null
java.io.UncheckedIOException
- thrown if, and only if, an I/O-error occurspublic static java.util.List<MethodParametersAttribute> filter(Node node)
List
with all MethodParametersAttribute
s.
All MethodParametersAttribute
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 MethodParametersAttribute
sjava.lang.NullPointerException
- thrown if, and only if, node
is null
public static MethodParametersAttribute newInstance(int attributeNameIndex)
MethodParametersAttribute
instance.
If attributeNameIndex
is less than or equal to 0
, an IllegalArgumentException
will be thrown.
attributeNameIndex
- the attribute_name_index of the new MethodParametersAttribute
instanceMethodParametersAttribute
instancejava.lang.IllegalArgumentException
- thrown if, and only if, attributeNameIndex
is less than or equal to 0
public static java.util.Optional<MethodParametersAttribute> find(MethodInfo methodInfo)
MethodParametersAttribute
instance in methodInfo
.
Returns an Optional
with the optional MethodParametersAttribute
instance.
If methodInfo
is null
, a NullPointerException
will be thrown.
methodInfo
- the MethodInfo
to check inOptional
with the optional MethodParametersAttribute
instancejava.lang.NullPointerException
- thrown if, and only if, methodInfo
is null