# Class ElementValuePairGen

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

public class ElementValuePairGen extends Object
Generates element value pairs in annotations.

Since:
  6.0

- ## Constructor Summary

  Constructors
  Modifier
  Constructor
  Description
  `protected`
  `ElementValuePairGen(int idx, ElementValueGen value, ConstantPoolGen cpool)`
  Constructs an ElementValuePairGen.
  ``
  `ElementValuePairGen(String name, ElementValueGen value, ConstantPoolGen cpool)`
  Constructs an ElementValuePairGen.
  ``
  `ElementValuePairGen(ElementValuePair nvp, ConstantPoolGen cpool, boolean copyPoolEntries)`
  Constructs an ElementValuePairGen from an ElementValuePair.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected void`
  `dump(DataOutputStream dos)`
  Dumps this element value pair to a DataOutputStream.
  `ElementValuePair`
  `getElementNameValuePair()`
  Retrieves an immutable version of this ElementValuePairGen.
  `int`
  `getNameIndex()`
  Gets the name index.
  `final String`
  `getNameString()`
  Gets the name string.
  `final ElementValueGen`
  `getValue()`
  Gets the value.
  `String`
  `toString()`

  ### Methods inherited from class Object

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

- ## Constructor Details

  - ### ElementValuePairGen

    public ElementValuePairGen(ElementValuePair nvp, ConstantPoolGen cpool, boolean copyPoolEntries)
    Constructs an ElementValuePairGen from an ElementValuePair.
    Parameters:
      `nvp` - the element value pair.
      `cpool` - the constant pool.
      `copyPoolEntries` - whether to copy pool entries.

  - ### ElementValuePairGen

    protected ElementValuePairGen(int idx, ElementValueGen value, ConstantPoolGen cpool)
    Constructs an ElementValuePairGen.
    Parameters:
      `idx` - the name index.
      `value` - the element value.
      `cpool` - the constant pool.

  - ### ElementValuePairGen

    public ElementValuePairGen(String name, ElementValueGen value, ConstantPoolGen cpool)
    Constructs an ElementValuePairGen.
    Parameters:
      `name` - the name.
      `value` - the element value.
      `cpool` - the constant pool.

- ## Method Details

  - ### dump

    protected void dump(DataOutputStream dos) throws IOException
    Dumps this element value pair to a DataOutputStream.
    Parameters:
      `dos` - the output stream.
    Throws:
      `IOException` - if an I/O error occurs.

  - ### getElementNameValuePair

    public ElementValuePair getElementNameValuePair()
    Retrieves an immutable version of this ElementValuePairGen.
    Returns:
      an immutable ElementValuePair.

  - ### getNameIndex

    public int getNameIndex()
    Gets the name index.
    Returns:
      the name index.

  - ### getNameString

    public final String getNameString()
    Gets the name string.
    Returns:
      the name string.

  - ### getValue

    public final ElementValueGen getValue()
    Gets the value.
    Returns:
      the element value.

  - ### toString

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