Package org.apache.bcel.generic
Class AnnotationEntryGen
- java.lang.Object
-
- org.apache.bcel.generic.AnnotationEntryGen
-
public class AnnotationEntryGen extends java.lang.Object
Generates annotation entries.- Since:
- 6.0
-
-
Constructor Summary
Constructors Constructor Description AnnotationEntryGen(AnnotationEntry a, ConstantPoolGen cpool, boolean copyPoolEntries)Here we are taking a fixed annotation of type Annotation and building a modifiable AnnotationGen object.AnnotationEntryGen(ObjectType type, java.util.List<ElementValuePairGen> elements, boolean vis, ConstantPoolGen cpool)Constructs an AnnotationEntryGen.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddElementNameValuePair(ElementValuePairGen evp)Adds an element name value pair.voiddump(java.io.DataOutputStream dos)Dumps this annotation entry to a DataOutputStream.AnnotationEntrygetAnnotation()Retrieves an immutable version of this AnnotationGen.intgetTypeIndex()Gets the type index.java.lang.StringgetTypeName()Gets the type name.java.lang.StringgetTypeSignature()Gets the type signature.java.util.List<ElementValuePairGen>getValues()Returns list of ElementNameValuePair objects.booleanisRuntimeVisible()Gets whether this annotation is runtime visible.static AnnotationEntryGenread(java.io.DataInput dis, ConstantPoolGen cpool, boolean b)Reads an AnnotationEntryGen from a DataInput.java.lang.StringtoShortString()Returns a short string representation of this annotation.java.lang.StringtoString()
-
-
-
Constructor Detail
-
AnnotationEntryGen
public AnnotationEntryGen(AnnotationEntry a, ConstantPoolGen cpool, boolean copyPoolEntries)
Here we are taking a fixed annotation of type Annotation and building a modifiable AnnotationGen object. If the pool passed in is for a different class file, then copyPoolEntries should have been passed as true as that will force us to do a deep copy of the annotation and move the cpool entries across. We need to copy the type and the element name value pairs and the visibility.- Parameters:
a- The annotation entry.cpool- The constant pool generator.copyPoolEntries- whether to copy pool entries.
-
AnnotationEntryGen
public AnnotationEntryGen(ObjectType type, java.util.List<ElementValuePairGen> elements, boolean vis, ConstantPoolGen cpool)
Constructs an AnnotationEntryGen.- Parameters:
type- The object type.elements- The element value pairs.vis- whether the annotation is visible.cpool- The constant pool generator.
-
-
Method Detail
-
read
public static AnnotationEntryGen read(java.io.DataInput dis, ConstantPoolGen cpool, boolean b) throws java.io.IOException
Reads an AnnotationEntryGen from a DataInput.- Parameters:
dis- The data input stream.cpool- The constant pool generator.b- whether the annotation is runtime visible.- Returns:
- The annotation entry generator.
- Throws:
java.io.IOException- Thrown if an I/O error occurs.
-
addElementNameValuePair
public void addElementNameValuePair(ElementValuePairGen evp)
Adds an element name value pair.- Parameters:
evp- The element value pair generator.
-
dump
public void dump(java.io.DataOutputStream dos) throws java.io.IOException
Dumps this annotation entry to a DataOutputStream.- Parameters:
dos- The data output stream.- Throws:
java.io.IOException- Thrown if an I/O error occurs.
-
getAnnotation
public AnnotationEntry getAnnotation()
Retrieves an immutable version of this AnnotationGen.- Returns:
- An immutable version of this AnnotationGen.
-
getTypeIndex
public int getTypeIndex()
Gets the type index.- Returns:
- The type index.
-
getTypeName
public final java.lang.String getTypeName()
Gets the type name.- Returns:
- The type name.
-
getTypeSignature
public final java.lang.String getTypeSignature()
Gets the type signature.- Returns:
- The type signature.
-
getValues
public java.util.List<ElementValuePairGen> getValues()
Returns list of ElementNameValuePair objects.- Returns:
- list of ElementNameValuePair objects.
-
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()
Returns 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
-
-