public final class SignatureAttribute extends AttributeInfo
SyntheticAttribute
denotes a Synthetic_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 Signature_attribute structure.
|
Modifier and Type | Method and Description |
---|---|
SignatureAttribute |
copy()
Returns a copy of this
SignatureAttribute instance. |
boolean |
equals(java.lang.Object object)
Returns
true if, and only if, object is an instance of SignatureAttribute , and that SignatureAttribute instance is equal to this SignatureAttribute instance, false
otherwise. |
static java.util.List<SignatureAttribute> |
filter(Node node)
Returns a
List with all SignatureAttribute s. |
static java.util.Optional<SignatureAttribute> |
find(ClassFile classFile)
Attempts to find a
SignatureAttribute instance in classFile . |
static java.util.Optional<SignatureAttribute> |
find(FieldInfo fieldInfo)
Attempts to find a
SignatureAttribute instance in fieldInfo . |
static java.util.Optional<SignatureAttribute> |
find(MethodInfo methodInfo)
Attempts to find a
SignatureAttribute instance in methodInfo . |
int |
getAttributeLength()
Returns the attribute_length of this
SignatureAttribute instance. |
int |
getSignatureIndex()
Returns the signature_index of this
SignatureAttribute instance. |
int |
hashCode()
Returns a hash code for this
SignatureAttribute instance. |
static SignatureAttribute |
newInstance(int attributeNameIndex,
int signatureIndex)
Returns a new
SyntheticAttribute instance. |
void |
setSignatureIndex(int signatureIndex)
Sets a new signature_index for this
SignatureAttribute instance. |
java.lang.String |
toString()
Returns a
String representation of this SignatureAttribute instance. |
void |
write(java.io.DataOutput dataOutput)
Writes this
SyntheticAttribute to dataOutput . |
getAttributeNameIndex, getName, setAttributeNameIndex
public static final java.lang.String NAME
public SignatureAttribute copy()
SignatureAttribute
instance.copy
in class AttributeInfo
SignatureAttribute
instancepublic java.lang.String toString()
String
representation of this SignatureAttribute
instance.toString
in class java.lang.Object
String
representation of this SignatureAttribute
instancepublic boolean equals(java.lang.Object object)
true
if, and only if, object
is an instance of SignatureAttribute
, and that SignatureAttribute
instance is equal to this SignatureAttribute
instance, false
otherwise.equals
in class java.lang.Object
object
- an Object
to compare to this SignatureAttribute
instance for equalitytrue
if, and only if, object
is an instance of SignatureAttribute
, and that SignatureAttribute
instance is equal to this SignatureAttribute
instance, false
otherwisepublic int getAttributeLength()
SignatureAttribute
instance.getAttributeLength
in class AttributeInfo
SignatureAttribute
instancepublic int getSignatureIndex()
SignatureAttribute
instance.SignatureAttribute
instancepublic int hashCode()
SignatureAttribute
instance.hashCode
in class java.lang.Object
SignatureAttribute
instancepublic void setSignatureIndex(int signatureIndex)
SignatureAttribute
instance.
If signatureIndex
is less than or equal to 0
, an IllegalArgumentException
will be thrown.
signatureIndex
- the new signature_index for this SignatureAttribute
instancejava.lang.IllegalArgumentException
- thrown if, and only if, signatureIndex
is less than or equal to 0
public void write(java.io.DataOutput dataOutput)
SyntheticAttribute
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<SignatureAttribute> filter(Node node)
List
with all SignatureAttribute
s.
All SignatureAttribute
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 SignatureAttribute
sjava.lang.NullPointerException
- thrown if, and only if, node
is null
public static java.util.Optional<SignatureAttribute> find(ClassFile classFile)
SignatureAttribute
instance in classFile
.
Returns an Optional
with the optional SignatureAttribute
instance.
If classFile
is null
, a NullPointerException
will be thrown.
classFile
- the ClassFile
to check inOptional
with the optional SignatureAttribute
instancejava.lang.NullPointerException
- thrown if, and only if, classFile
is null
public static java.util.Optional<SignatureAttribute> find(FieldInfo fieldInfo)
SignatureAttribute
instance in fieldInfo
.
Returns an Optional
with the optional SignatureAttribute
instance.
If fieldInfo
is null
, a NullPointerException
will be thrown.
fieldInfo
- the FieldInfo
to check inOptional
with the optional SignatureAttribute
instancejava.lang.NullPointerException
- thrown if, and only if, fieldInfo
is null
public static java.util.Optional<SignatureAttribute> find(MethodInfo methodInfo)
SignatureAttribute
instance in methodInfo
.
Returns an Optional
with the optional SignatureAttribute
instance.
If methodInfo
is null
, a NullPointerException
will be thrown.
methodInfo
- the MethodInfo
to check inOptional
with the optional SignatureAttribute
instancejava.lang.NullPointerException
- thrown if, and only if, methodInfo
is null
public static SignatureAttribute newInstance(int attributeNameIndex, int signatureIndex)
SyntheticAttribute
instance.
If either attributeNameIndex
or signatureIndex
are less than or equal to 0
, an IllegalArgumentException
will be thrown.
attributeNameIndex
- the attribute_name_index of the new SignatureAttribute
instancesignatureIndex
- the signature_index of the new SignatureAttribute
instanceSignatureAttribute
instancejava.lang.IllegalArgumentException
- thrown if, and only if, either attributeNameIndex
or signatureIndex
are less than or equal to 0