# Class AnnotationEntryGen

java.lang.Object
org.apache.bcel.generic.AnnotationEntryGen

public class AnnotationEntryGen extends 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, List<ElementValuePairGen> elements, boolean vis, ConstantPoolGen cpool)`
  Constructs an AnnotationEntryGen.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `addElementNameValuePair(ElementValuePairGen evp)`
  Adds an element name value pair.
  `void`
  `dump(DataOutputStream dos)`
  Dumps this annotation entry to a DataOutputStream.
  `AnnotationEntry`
  `getAnnotation()`
  Retrieves an immutable version of this AnnotationGen.
  `int`
  `getTypeIndex()`
  Gets the type index.
  `final String`
  `getTypeName()`
  Gets the type name.
  `final String`
  `getTypeSignature()`
  Gets the type signature.
  `List<ElementValuePairGen>`
  `getValues()`
  Returns list of ElementNameValuePair objects.
  `boolean`
  `isRuntimeVisible()`
  Gets whether this annotation is runtime visible.
  `static AnnotationEntryGen`
  `read(DataInput dis, ConstantPoolGen cpool, boolean b)`
  Reads an AnnotationEntryGen from a DataInput.
  `String`
  `toShortString()`
  Returns a short string representation of this annotation.
  `String`
  `toString()`

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Constructor Details

  - ### 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, 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 Details

  - ### read

    public static AnnotationEntryGen read(DataInput dis, ConstantPoolGen cpool, boolean b) throws 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:
      `IOException` - 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(DataOutputStream dos) throws IOException
    Dumps this annotation entry to a DataOutputStream.
    Parameters:
      `dos` - the data output stream.
    Throws:
      `IOException` - 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 String getTypeName()
    Gets the type name.
    Returns:
      the type name.

  - ### getTypeSignature

    public final String getTypeSignature()
    Gets the type signature.
    Returns:
      the type signature.

  - ### getValues

    public 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 String toShortString()
    Returns a short string representation of this annotation.
    Returns:
      a short string representation of this annotation.

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `Object`