Package org.apache.bcel.classfile
Class AnnotationEntry
- java.lang.Object
-
- org.apache.bcel.classfile.AnnotationEntry
-
- All Implemented Interfaces:
Node
public class AnnotationEntry extends java.lang.Object implements Node
Represents one annotation in the annotation table- Since:
- 6.0
-
-
Field Summary
Fields Modifier and Type Field Description static AnnotationEntry[]EMPTY_ARRAYEmpty array of AnnotationEntry objects.
-
Constructor Summary
Constructors Constructor Description AnnotationEntry(int typeIndex, ConstantPool constantPool, boolean isRuntimeVisible)Constructs an AnnotationEntry.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaccept(Visitor v)Called by objects that are traversing the nodes of the tree implicitly defined by the contents of a Java class.voidaddElementNameValuePair(ElementValuePair elementNameValuePair)Adds an element name value pair.static AnnotationEntry[]createAnnotationEntries(Attribute[] attributes)Creates annotation entries from attributes.voiddump(java.io.DataOutputStream dos)Dumps this annotation entry to a DataOutputStream.java.lang.StringgetAnnotationType()Gets the annotation type name.intgetAnnotationTypeIndex()Gets the annotation type index.ConstantPoolgetConstantPool()Gets the constant pool.ElementValuePair[]getElementValuePairs()Gets the element value pairs in this annotation entry.intgetNumElementValuePairs()Gets the number of element value pairs in this annotation entry.intgetTypeIndex()Gets the type index.booleanisRuntimeVisible()Gets whether this annotation is runtime visible.static AnnotationEntryread(java.io.DataInput input, ConstantPool constantPool, boolean isRuntimeVisible)Factory method to create an AnnotionEntry from a DataInput.java.lang.StringtoShortString()Gets a short string representation of this annotation.java.lang.StringtoString()
-
-
-
Field Detail
-
EMPTY_ARRAY
public static final AnnotationEntry[] EMPTY_ARRAY
Empty array of AnnotationEntry objects.
-
-
Constructor Detail
-
AnnotationEntry
public AnnotationEntry(int typeIndex, ConstantPool constantPool, boolean isRuntimeVisible)
Constructs an AnnotationEntry.- Parameters:
typeIndex- The type index.constantPool- The constant pool.isRuntimeVisible- whether the annotation is runtime visible.
-
-
Method Detail
-
createAnnotationEntries
public static AnnotationEntry[] createAnnotationEntries(Attribute[] attributes)
Creates annotation entries from attributes.- Parameters:
attributes- The attributes.- Returns:
- The annotation entries.
-
read
public static AnnotationEntry read(java.io.DataInput input, ConstantPool constantPool, boolean isRuntimeVisible) throws java.io.IOException
Factory method to create an AnnotionEntry from a DataInput.- Parameters:
input- The input stream.constantPool- The constant pool.isRuntimeVisible- whether the annotation is runtime visible.- Returns:
- The entry.
- Throws:
java.io.IOException- Thrown if an I/O error occurs.
-
accept
public void accept(Visitor v)
Called by objects that are traversing the nodes of the tree implicitly defined by the contents of a Java class. I.e., the hierarchy of methods, fields, attributes, etc. spawns a tree of objects.
-
addElementNameValuePair
public void addElementNameValuePair(ElementValuePair elementNameValuePair)
Adds an element name value pair.- Parameters:
elementNameValuePair- The element name value pair.
-
dump
public void dump(java.io.DataOutputStream dos) throws java.io.IOException
Dumps this annotation entry to a DataOutputStream.- Parameters:
dos- The output stream.- Throws:
java.io.IOException- Thrown if an I/O error occurs.
-
getAnnotationType
public java.lang.String getAnnotationType()
Gets the annotation type name.- Returns:
- The annotation type name.
-
getAnnotationTypeIndex
public int getAnnotationTypeIndex()
Gets the annotation type index.- Returns:
- The annotation type index.
-
getConstantPool
public ConstantPool getConstantPool()
Gets the constant pool.- Returns:
- The constant pool.
-
getElementValuePairs
public ElementValuePair[] getElementValuePairs()
Gets the element value pairs in this annotation entry.- Returns:
- The element value pairs in this annotation entry.
-
getNumElementValuePairs
public final int getNumElementValuePairs()
Gets the number of element value pairs in this annotation entry.- Returns:
- The number of element value pairs in this annotation entry.
-
getTypeIndex
public int getTypeIndex()
Gets the type index.- Returns:
- The type index.
-
isRuntimeVisible
public boolean isRuntimeVisible()
Gets whether this annotation is runtime visible.- Returns:
- true if this annotation is runtime visible.
-
toShortString
public java.lang.String toShortString()
Gets a short string representation of this annotation.- Returns:
- A short string representation of this annotation.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-