# Class AnnotationElementValueGen

java.lang.Object
org.apache.bcel.generic.ElementValueGen
org.apache.bcel.generic.AnnotationElementValueGen

public class AnnotationElementValueGen extends ElementValueGen
Generates annotation element values.

Since:
  6.0

- ## Field Summary

  ### Fields inherited from class ElementValueGen

  `ANNOTATION, ARRAY, CLASS, cpGen, ENUM_CONSTANT, PRIMITIVE_BOOLEAN, PRIMITIVE_BYTE, PRIMITIVE_CHAR, PRIMITIVE_DOUBLE, PRIMITIVE_FLOAT, PRIMITIVE_INT, PRIMITIVE_LONG, PRIMITIVE_SHORT, STRING, type`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `AnnotationElementValueGen(int type, AnnotationEntryGen annotation, ConstantPoolGen cpool)`
  Constructs an AnnotationElementValueGen.
  `AnnotationElementValueGen(AnnotationElementValue value, ConstantPoolGen cpool, boolean copyPoolEntries)`
  Constructs an AnnotationElementValueGen.
  `AnnotationElementValueGen(AnnotationEntryGen a, ConstantPoolGen cpool)`
  Constructs an AnnotationElementValueGen.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `dump(DataOutputStream dos)`
  Dumps this element value to a DataOutputStream.
  `AnnotationEntryGen`
  `getAnnotation()`
  Gets the annotation.
  `ElementValue`
  `getElementValue()`
  Returns an immutable variant of this AnnotationElementValueGen.
  `String`
  `stringifyValue()`
  Returns a string representation of the element value.

  ### Methods inherited from class ElementValueGen

  `copy, getConstantPool, getElementValueType, readElementValue`

  ### Methods inherited from class Object

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

- ## Constructor Details

  - ### AnnotationElementValueGen

    public AnnotationElementValueGen(AnnotationElementValue value, ConstantPoolGen cpool, boolean copyPoolEntries)
    Constructs an AnnotationElementValueGen.
    Parameters:
      `value` - the annotation element value.
      `cpool` - the constant pool generator.
      `copyPoolEntries` - whether to copy pool entries.

  - ### AnnotationElementValueGen

    public AnnotationElementValueGen(AnnotationEntryGen a, ConstantPoolGen cpool)
    Constructs an AnnotationElementValueGen.
    Parameters:
      `a` - the annotation entry generator.
      `cpool` - the constant pool generator.

  - ### AnnotationElementValueGen

    public AnnotationElementValueGen(int type, AnnotationEntryGen annotation, ConstantPoolGen cpool)
    Constructs an AnnotationElementValueGen.
    Parameters:
      `type` - the type.
      `annotation` - the annotation.
      `cpool` - the constant pool generator.

- ## Method Details

  - ### dump

    public void dump(DataOutputStream dos) throws IOException
    Description copied from class: `ElementValueGen`
    Dumps this element value to a DataOutputStream.
    Specified by:
      `dump` in class `ElementValueGen`
    Parameters:
      `dos` - the output stream.
    Throws:
      `IOException` - if an I/O error occurs.

  - ### getAnnotation

    public AnnotationEntryGen getAnnotation()
    Gets the annotation.
    Returns:
      the annotation.

  - ### getElementValue

    public ElementValue getElementValue()
    Returns an immutable variant of this AnnotationElementValueGen.
    Specified by:
      `getElementValue` in class `ElementValueGen`
    Returns:
      an immutable variant of this AnnotationElementValueGen.

  - ### stringifyValue

    public String stringifyValue()
    Description copied from class: `ElementValueGen`
    Returns a string representation of the element value.
    Specified by:
      `stringifyValue` in class `ElementValueGen`
    Returns:
      a string representation of the element value.