public final class SourceFileAttribute extends AttributeInfo
SourceFileAttribute
denotes a SourceFile_attribute structure somewhere in a ClassFile structure.
This class is not thread-safe.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
NAME
The name of the SourceFile_attribute structure.
|
Modifier and Type | Method and Description |
---|---|
SourceFileAttribute |
copy()
Returns a copy of this
SourceFileAttribute instance. |
boolean |
equals(java.lang.Object object)
Returns
true if, and only if, object is an instance of SourceFileAttribute , and that SourceFileAttribute instance is equal to this SourceFileAttribute instance, false
otherwise. |
static java.util.List<SourceFileAttribute> |
filter(Node node)
Returns a
List with all SourceFileAttribute s. |
int |
getAttributeLength()
Returns the attribute_length of this
SourceFileAttribute instance. |
int |
getSourceFileIndex()
Returns the sourcefile_index of this
SourceFileAttribute instance. |
int |
hashCode()
Returns a hash code for this
SourceFileAttribute instance. |
static SourceFileAttribute |
newInstance(int attributeNameIndex,
int sourceFileIndex)
Returns a new
SourceFileAttribute instance. |
void |
setSourceFileIndex(int sourceFileIndex)
Sets a new sourcefile_index for this
SourceFileAttribute instance. |
java.lang.String |
toString()
Returns a
String representation of this SourceFileAttribute instance. |
void |
write(java.io.DataOutput dataOutput)
Writes this
SourceFileAttribute to dataOutput . |
getAttributeNameIndex, getName, setAttributeNameIndex
public static final java.lang.String NAME
public SourceFileAttribute copy()
SourceFileAttribute
instance.copy
in class AttributeInfo
SourceFileAttribute
instancepublic java.lang.String toString()
String
representation of this SourceFileAttribute
instance.toString
in class java.lang.Object
String
representation of this SourceFileAttribute
instancepublic boolean equals(java.lang.Object object)
true
if, and only if, object
is an instance of SourceFileAttribute
, and that SourceFileAttribute
instance is equal to this SourceFileAttribute
instance, false
otherwise.equals
in class java.lang.Object
object
- an Object
to compare to this SourceFileAttribute
instance for equalitytrue
if, and only if, object
is an instance of SourceFileAttribute
, and that SourceFileAttribute
instance is equal to this SourceFileAttribute
instance, false
otherwisepublic int getAttributeLength()
SourceFileAttribute
instance.getAttributeLength
in class AttributeInfo
SourceFileAttribute
instancepublic int getSourceFileIndex()
SourceFileAttribute
instance.SourceFileAttribute
instancepublic int hashCode()
SourceFileAttribute
instance.hashCode
in class java.lang.Object
SourceFileAttribute
instancepublic void setSourceFileIndex(int sourceFileIndex)
SourceFileAttribute
instance.
If sourceFileIndex
is less than or equal to 0
, an IllegalArgumentException
will be thrown.
sourceFileIndex
- the new sourcefile_index for this SourceFileAttribute
instancejava.lang.IllegalArgumentException
- thrown if, and only if, sourceFileIndex
is less than or equal to 0
public void write(java.io.DataOutput dataOutput)
SourceFileAttribute
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<SourceFileAttribute> filter(Node node)
List
with all SourceFileAttribute
s.
All SourceFileAttribute
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 SourceFileAttribute
sjava.lang.NullPointerException
- thrown if, and only if, node
is null
public static SourceFileAttribute newInstance(int attributeNameIndex, int sourceFileIndex)
SourceFileAttribute
instance.
If either attributeNameIndex
or sourceFileIndex
are less than or equal to 0
, an IllegalArgumentException
will be thrown.
attributeNameIndex
- the attribute_name_index of the new SourceFileAttribute
instancesourceFileIndex
- the sourcefile_index of the new SourceFileAttribute
instanceSourceFileAttribute
instancejava.lang.IllegalArgumentException
- thrown if, and only if, either attributeNameIndex
or sourceFileIndex
are less than or equal to 0