public final class LineNumberTableAttribute extends AttributeInfo
LineNumberTableAttribute
denotes a LineNumberTable_attribute structure somewhere in a ClassFile structure.
This class is not thread-safe.
Modifier and Type | Class and Description |
---|---|
static class |
LineNumberTableAttribute.LineNumber
A
LineNumber denotes a line_number structure somewhere in a LineNumberTable_attribute structure. |
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
NAME
The name of the LocalVariableTable_attribute structure.
|
Modifier and Type | Method and Description |
---|---|
boolean |
accept(NodeHierarchicalVisitor nodeHierarchicalVisitor)
Accepts a
NodeHierarchicalVisitor . |
void |
addLineNumber(LineNumberTableAttribute.LineNumber lineNumber)
Adds
lineNumber to this LineNumberTableAttribute instance. |
LineNumberTableAttribute |
copy()
Returns a copy of this
LineNumberTableAttribute instance. |
boolean |
equals(java.lang.Object object)
Returns
true if, and only if, object is an instance of LineNumberTableAttribute , and that LineNumberTableAttribute instance is equal to this LineNumberTableAttribute instance,
false otherwise. |
static java.util.List<LineNumberTableAttribute> |
filter(Node node)
Returns a
List with all LineNumberTableAttribute s. |
int |
getAttributeLength()
Returns the attribute_length of this
LineNumberTableAttribute instance. |
java.util.List<LineNumberTableAttribute.LineNumber> |
getLineNumberTable()
Returns a
List with all currently added LineNumber s. |
int |
getLineNumberTableLength()
Returns the line_number_table_length of this
LineNumberTableAttribute instance. |
int |
hashCode()
Returns a hash code for this
LineNumberTableAttribute instance. |
static LineNumberTableAttribute |
newInstance(int attributeNameIndex)
Returns a new
LineNumberTableAttribute instance. |
void |
removeLineNumber(LineNumberTableAttribute.LineNumber lineNumber)
Removes
lineNumber from this LineNumberTableAttribute instance. |
java.lang.String |
toString()
Returns a
String representation of this LineNumberTableAttribute instance. |
void |
write(java.io.DataOutput dataOutput)
Writes this
LineNumberTableAttribute to dataOutput . |
getAttributeNameIndex, getName, setAttributeNameIndex
public static final java.lang.String NAME
public LineNumberTableAttribute copy()
LineNumberTableAttribute
instance.copy
in class AttributeInfo
LineNumberTableAttribute
instancepublic java.util.List<LineNumberTableAttribute.LineNumber> getLineNumberTable()
List
with all currently added LineNumber
s.
Modifying the returned List
will not affect this LineNumberTableAttribute
instance.
List
with all currently added LineNumber
spublic java.lang.String toString()
String
representation of this LineNumberTableAttribute
instance.toString
in class java.lang.Object
String
representation of this LineNumberTableAttribute
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 LineNumberTableAttribute
, and that LineNumberTableAttribute
instance is equal to this LineNumberTableAttribute
instance,
false
otherwise.equals
in class java.lang.Object
object
- an Object
to compare to this LineNumberTableAttribute
instance for equalitytrue
if, and only if, object
is an instance of LineNumberTableAttribute
, and that LineNumberTableAttribute
instance is equal to this LineNumberTableAttribute
instance,
false
otherwisepublic int getAttributeLength()
LineNumberTableAttribute
instance.getAttributeLength
in class AttributeInfo
LineNumberTableAttribute
instance.public int getLineNumberTableLength()
LineNumberTableAttribute
instance.LineNumberTableAttribute
instance.public int hashCode()
LineNumberTableAttribute
instance.hashCode
in class java.lang.Object
LineNumberTableAttribute
instancepublic void addLineNumber(LineNumberTableAttribute.LineNumber lineNumber)
lineNumber
to this LineNumberTableAttribute
instance.
If lineNumber
is null
, a NullPointerException
will be thrown.
lineNumber
- the LineNumberTableAttribute.LineNumber
to addpublic void removeLineNumber(LineNumberTableAttribute.LineNumber lineNumber)
lineNumber
from this LineNumberTableAttribute
instance.
If lineNumber
is null
, a NullPointerException
will be thrown.
lineNumber
- the LineNumberTableAttribute.LineNumber
to removepublic void write(java.io.DataOutput dataOutput)
LineNumberTableAttribute
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 LineNumberTableAttribute newInstance(int attributeNameIndex)
LineNumberTableAttribute
instance.
If attributeNameIndex
is less than or equal to 0
, an IllegalArgumentException
will be thrown.
attributeNameIndex
- the attribute_name_index of the new LineNumberTableAttribute
instanceLineNumberTableAttribute
instancejava.lang.IllegalArgumentException
- thrown if, and only if, attributeNameIndex
is less than or equal to 0
public static java.util.List<LineNumberTableAttribute> filter(Node node)
List
with all LineNumberTableAttribute
s.
All LineNumberTableAttribute
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 LineNumberTableAttribute
sjava.lang.NullPointerException
- thrown if, and only if, node
is null