Package org.apache.bcel.generic
Class AnnotationEntryGen
- java.lang.Object
-
- org.apache.bcel.generic.AnnotationEntryGen
-
public class AnnotationEntryGen extends java.lang.Object
- Since:
- 6.0
-
-
Field Summary
Fields Modifier and Type Field Description private ConstantPoolGen
cpool
private java.util.List<ElementValuePairGen>
evs
private boolean
isRuntimeVisible
private int
typeIndex
-
Constructor Summary
Constructors Modifier 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.private
AnnotationEntryGen(ConstantPoolGen cpool)
AnnotationEntryGen(ObjectType type, java.util.List<ElementValuePairGen> elements, boolean vis, ConstantPoolGen cpool)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addElementNameValuePair(ElementValuePairGen evp)
private java.util.List<ElementValuePairGen>
copyValues(ElementValuePair[] in, ConstantPoolGen cpool, boolean copyPoolEntries)
void
dump(java.io.DataOutputStream dos)
AnnotationEntry
getAnnotation()
Retrieve an immutable version of this AnnotationGen(package private) static Attribute[]
getAnnotationAttributes(ConstantPoolGen cp, AnnotationEntryGen[] annotationEntryGens)
Converts a list of AnnotationGen objects into a set of attributes that can be attached to the class file.(package private) static Attribute[]
getParameterAnnotationAttributes(ConstantPoolGen cp, java.util.List<AnnotationEntryGen>[] vec)
Annotations against a class are stored in one of four attribute kinds: - RuntimeVisibleParameterAnnotations - RuntimeInvisibleParameterAnnotationsint
getTypeIndex()
java.lang.String
getTypeName()
java.lang.String
getTypeSignature()
java.util.List<ElementValuePairGen>
getValues()
Returns list of ElementNameValuePair objectsboolean
isRuntimeVisible()
private void
isRuntimeVisible(boolean b)
static AnnotationEntryGen
read(java.io.DataInput dis, ConstantPoolGen cpool, boolean b)
java.lang.String
toShortString()
java.lang.String
toString()
-
-
-
Field Detail
-
typeIndex
private int typeIndex
-
evs
private java.util.List<ElementValuePairGen> evs
-
cpool
private final ConstantPoolGen cpool
-
isRuntimeVisible
private boolean isRuntimeVisible
-
-
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.
-
AnnotationEntryGen
private AnnotationEntryGen(ConstantPoolGen cpool)
-
AnnotationEntryGen
public AnnotationEntryGen(ObjectType type, java.util.List<ElementValuePairGen> elements, boolean vis, ConstantPoolGen cpool)
-
-
Method Detail
-
copyValues
private java.util.List<ElementValuePairGen> copyValues(ElementValuePair[] in, ConstantPoolGen cpool, boolean copyPoolEntries)
-
getAnnotation
public AnnotationEntry getAnnotation()
Retrieve an immutable version of this AnnotationGen
-
read
public static AnnotationEntryGen read(java.io.DataInput dis, ConstantPoolGen cpool, boolean b) throws java.io.IOException
- Throws:
java.io.IOException
-
dump
public void dump(java.io.DataOutputStream dos) throws java.io.IOException
- Throws:
java.io.IOException
-
addElementNameValuePair
public void addElementNameValuePair(ElementValuePairGen evp)
-
getTypeIndex
public int getTypeIndex()
-
getTypeSignature
public final java.lang.String getTypeSignature()
-
getTypeName
public final java.lang.String getTypeName()
-
getValues
public java.util.List<ElementValuePairGen> getValues()
Returns list of ElementNameValuePair objects
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
toShortString
public java.lang.String toShortString()
-
isRuntimeVisible
private void isRuntimeVisible(boolean b)
-
isRuntimeVisible
public boolean isRuntimeVisible()
-
getAnnotationAttributes
static Attribute[] getAnnotationAttributes(ConstantPoolGen cp, AnnotationEntryGen[] annotationEntryGens)
Converts a list of AnnotationGen objects into a set of attributes that can be attached to the class file.- Parameters:
cp
- The constant pool gen where we can create the necessary name refsannotationEntryGens
- An array of AnnotationGen objects
-
getParameterAnnotationAttributes
static Attribute[] getParameterAnnotationAttributes(ConstantPoolGen cp, java.util.List<AnnotationEntryGen>[] vec)
Annotations against a class are stored in one of four attribute kinds: - RuntimeVisibleParameterAnnotations - RuntimeInvisibleParameterAnnotations
-
-