public final class RuntimeVisibleAnnotationsAttribute extends AttributeInfo
RuntimeVisibleAnnotationsAttribute
denotes a RuntimeVisibleAnnotations_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 RuntimeVisibleAnnotations_attribute structure.
|
Modifier and Type | Method and Description |
---|---|
boolean |
accept(NodeHierarchicalVisitor nodeHierarchicalVisitor)
Accepts a
NodeHierarchicalVisitor . |
void |
addAnnotation(Annotations.Annotation annotation)
Adds
annotation to the annotations of this RuntimeVisibleAnnotationsAttribute instance. |
RuntimeVisibleAnnotationsAttribute |
copy()
Returns a copy of this
RuntimeVisibleAnnotationsAttribute instance. |
boolean |
equals(java.lang.Object object)
Returns
true if, and only if, object is an instance of RuntimeVisibleAnnotationsAttribute , and that RuntimeVisibleAnnotationsAttribute instance is equal to this
RuntimeVisibleAnnotationsAttribute instance, false otherwise. |
static java.util.List<RuntimeVisibleAnnotationsAttribute> |
filter(Node node)
Returns a
List with all RuntimeVisibleAnnotationsAttribute s. |
java.util.List<Annotations.Annotation> |
getAnnotations()
Returns the annotations of this
RuntimeVisibleAnnotationsAttribute instance. |
int |
getAttributeLength()
Returns the attribute_length of this
RuntimeVisibleAnnotationsAttribute instance. |
int |
getNumAnnotations()
Returns the num_annotations of this
RuntimeVisibleAnnotationsAttribute instance. |
int |
hashCode()
Returns a hash code for this
RuntimeVisibleAnnotationsAttribute instance. |
static RuntimeVisibleAnnotationsAttribute |
newInstance(int attributeNameIndex)
Returns a new
RuntimeVisibleAnnotationsAttribute instance. |
void |
removeAnnotation(Annotations.Annotation annotation)
Removes
annotation from the annotations of this RuntimeVisibleAnnotationsAttribute instance. |
java.lang.String |
toString()
Returns a
String representation of this RuntimeVisibleAnnotationsAttribute instance. |
void |
write(java.io.DataOutput dataOutput)
Writes this
RuntimeVisibleAnnotationsAttribute to dataOutput . |
getAttributeNameIndex, getName, setAttributeNameIndex
public static final java.lang.String NAME
public java.util.List<Annotations.Annotation> getAnnotations()
RuntimeVisibleAnnotationsAttribute
instance.
Modifying the returned List
will not affect this RuntimeVisibleAnnotationsAttribute
instance.
RuntimeVisibleAnnotationsAttribute
instancepublic RuntimeVisibleAnnotationsAttribute copy()
RuntimeVisibleAnnotationsAttribute
instance.copy
in class AttributeInfo
RuntimeVisibleAnnotationsAttribute
instancepublic java.lang.String toString()
String
representation of this RuntimeVisibleAnnotationsAttribute
instance.toString
in class java.lang.Object
String
representation of this RuntimeVisibleAnnotationsAttribute
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 RuntimeVisibleAnnotationsAttribute
, and that RuntimeVisibleAnnotationsAttribute
instance is equal to this
RuntimeVisibleAnnotationsAttribute
instance, false
otherwise.equals
in class java.lang.Object
object
- an Object
to compare to this RuntimeVisibleAnnotationsAttribute
instance for equalitytrue
if, and only if, object
is an instance of RuntimeVisibleAnnotationsAttribute
, and that RuntimeVisibleAnnotationsAttribute
instance is equal to this
RuntimeVisibleAnnotationsAttribute
instance, false
otherwisepublic int getAttributeLength()
RuntimeVisibleAnnotationsAttribute
instance.getAttributeLength
in class AttributeInfo
RuntimeVisibleAnnotationsAttribute
instancepublic int getNumAnnotations()
RuntimeVisibleAnnotationsAttribute
instance.RuntimeVisibleAnnotationsAttribute
instancepublic int hashCode()
RuntimeVisibleAnnotationsAttribute
instance.hashCode
in class java.lang.Object
RuntimeVisibleAnnotationsAttribute
instancepublic void addAnnotation(Annotations.Annotation annotation)
annotation
to the annotations of this RuntimeVisibleAnnotationsAttribute
instance.
If annotation
is null
, a NullPointerException
will be thrown.
annotation
- the Annotations.Annotation
to addjava.lang.NullPointerException
- thrown if, and only if, annotation
is null
public void removeAnnotation(Annotations.Annotation annotation)
annotation
from the annotations of this RuntimeVisibleAnnotationsAttribute
instance.
If annotation
is null
, a NullPointerException
will be thrown.
annotation
- the Annotations.Annotation
to removejava.lang.NullPointerException
- thrown if, and only if, annotation
is null
public void write(java.io.DataOutput dataOutput)
RuntimeVisibleAnnotationsAttribute
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<RuntimeVisibleAnnotationsAttribute> filter(Node node)
List
with all RuntimeVisibleAnnotationsAttribute
s.
All RuntimeVisibleAnnotationsAttribute
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 RuntimeVisibleAnnotationsAttribute
sjava.lang.NullPointerException
- thrown if, and only if, node
is null
public static RuntimeVisibleAnnotationsAttribute newInstance(int attributeNameIndex)
RuntimeVisibleAnnotationsAttribute
instance.
If attributeNameIndex
is less than or equal to 0
, an IllegalArgumentException
will be thrown.
attributeNameIndex
- the attribute_name_index of the new RuntimeVisibleAnnotationsAttribute
instanceRuntimeVisibleAnnotationsAttribute
instancejava.lang.IllegalArgumentException
- thrown if, and only if, attributeNameIndex
is less than or equal to 0