Top Fields Constructors Methods
org.apache.bcel.generic

public Class AnnotationEntryGen

extends Object
Class Inheritance
Imports
java.io.ByteArrayInputStream, .ByteArrayOutputStream, .DataInput, .DataInputStream, .DataOutputStream, .IOException, java.util.ArrayList, .List, org.apache.bcel.classfile.AnnotationEntry, .Attribute, .ConstantUtf8, .ElementValuePair, .RuntimeInvisibleAnnotations, .RuntimeInvisibleParameterAnnotations, .RuntimeVisibleAnnotations, .RuntimeVisibleParameterAnnotations

Since
6.0

Field Summary

Modifier and TypeField and Description
private final ConstantPoolGen
pack-priv static final AnnotationEntryGen[]
private List<ElementValuePairGen>
private boolean
private int

Constructor Summary

AccessConstructor and Description
public
AnnotationEntryGen(final AnnotationEntry a, final ConstantPoolGen cpool, final boolean copyPoolEntries)

Here we are taking a fixed annotation of type Annotation and building a modifiable AnnotationGen object.

private
public
AnnotationEntryGen(final ObjectType type, final List<ElementValuePairGen> elements, final boolean vis, final ConstantPoolGen cpool)

Method Summary

Modifier and TypeMethod and Description
public void
private List<ElementValuePairGen>
copyValues(final ElementValuePair[] in, final ConstantPoolGen cpool, final boolean copyPoolEntries)

public void
public AnnotationEntry
getAnnotation()

Retrieve an immutable version of this AnnotationGen

pack-priv static Attribute[]
getAnnotationAttributes(final ConstantPoolGen
The constant pool gen where we can create the necessary name refs
cp
,
final AnnotationEntryGen[]
An array of AnnotationGen objects
annotationEntryGens
)

Converts a list of AnnotationGen objects into a set of attributes that can be attached to the class file.

pack-priv static Attribute[]
getParameterAnnotationAttributes(final ConstantPoolGen cp, final List<AnnotationEntryGen>[] vec)

Annotations against a class are stored in one of four attribute kinds: - RuntimeVisibleParameterAnnotations - RuntimeInvisibleParameterAnnotations

public int
public final String
public final String
public List<ElementValuePairGen>

Returns:

list of ElementNameValuePair objects.
getValues
()

Returns list of ElementNameValuePair objects.

public boolean
private void
isRuntimeVisible(final boolean b)

public static AnnotationEntryGen
read(final DataInput dis, final ConstantPoolGen cpool, final boolean b)

public String
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

cpoolback to summary
private final ConstantPoolGen cpool
EMPTY_ARRAYback to summary
pack-priv static final AnnotationEntryGen[] EMPTY_ARRAY
evsback to summary
private List<ElementValuePairGen> evs
isRuntimeVisibleback to summary
private boolean isRuntimeVisible
typeIndexback to summary
private int typeIndex

Constructor Detail

AnnotationEntryGenback to summary
public AnnotationEntryGen(final AnnotationEntry a, final ConstantPoolGen cpool, final 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.

AnnotationEntryGenback to summary
private AnnotationEntryGen(final ConstantPoolGen cpool)
AnnotationEntryGenback to summary
public AnnotationEntryGen(final ObjectType type, final List<ElementValuePairGen> elements, final boolean vis, final ConstantPoolGen cpool)

Method Detail

addElementNameValuePairback to summary
public void addElementNameValuePair(final ElementValuePairGen evp)
copyValuesback to summary
private List<ElementValuePairGen> copyValues(final ElementValuePair[] in, final ConstantPoolGen cpool, final boolean copyPoolEntries)
dumpback to summary
public void dump(final DataOutputStream dos) throws IOException
getAnnotationback to summary
public AnnotationEntry getAnnotation()

Retrieve an immutable version of this AnnotationGen

getAnnotationAttributesback to summary
pack-priv static Attribute[] getAnnotationAttributes(final ConstantPoolGen cp, final AnnotationEntryGen[] annotationEntryGens)

Converts a list of AnnotationGen objects into a set of attributes that can be attached to the class file.

Parameters
cp:ConstantPoolGen

The constant pool gen where we can create the necessary name refs

annotationEntryGens:AnnotationEntryGen[]

An array of AnnotationGen objects

getParameterAnnotationAttributesback to summary
pack-priv static Attribute[] getParameterAnnotationAttributes(final ConstantPoolGen cp, final List<AnnotationEntryGen>[] vec)

Annotations against a class are stored in one of four attribute kinds: - RuntimeVisibleParameterAnnotations - RuntimeInvisibleParameterAnnotations

getTypeIndexback to summary
public int getTypeIndex()
getTypeNameback to summary
public final String getTypeName()
getTypeSignatureback to summary
public final String getTypeSignature()
getValuesback to summary
public List<ElementValuePairGen> getValues()

Returns list of ElementNameValuePair objects.

Returns:List<ElementValuePairGen>

list of ElementNameValuePair objects.

isRuntimeVisibleback to summary
public boolean isRuntimeVisible()
isRuntimeVisibleback to summary
private void isRuntimeVisible(final boolean b)
readback to summary
public static AnnotationEntryGen read(final DataInput dis, final ConstantPoolGen cpool, final boolean b) throws IOException
toShortStringback to summary
public String toShortString()
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override