Package org.codehaus.janino.util

# Class ClassFile.ConstantElementValue

java.lang.Object
org.codehaus.janino.util.ClassFile.ConstantElementValue

All Implemented Interfaces:
  `ClassFile.ElementValue`

Direct Known Subclasses:
  `ClassFile.BooleanElementValue`, `ClassFile.ByteElementValue`, `ClassFile.CharElementValue`, `ClassFile.ClassElementValue`, `ClassFile.DoubleElementValue`, `ClassFile.FloatElementValue`, `ClassFile.IntElementValue`, `ClassFile.LongElementValue`, `ClassFile.ShortElementValue`, `ClassFile.StringElementValue`

Enclosing class:
  `ClassFile`

public abstract static class ClassFile.ConstantElementValue extends Object implements ClassFile.ElementValue
Convenience class for element values that are constants (as opposed to annotations, enum constants and arrays).

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`static interface`
`ClassFile.ConstantElementValue.Visitor<R,EX extends Throwable>`
The visitor interface for the implementation of the "visitor" pattern.

## Field Summary

Fields
Modifier and Type
Field
Description
`final short`
`constantValueIndex`
The index of the constant pool entry that holds the constant value for this annotation element.

## Constructor Summary

Constructors
Constructor
Description
`ConstantElementValue(byte tag, short constantValueIndex)`

## Method Summary

Modifier and Type
Method
Description
`protected abstract <R, EX extends Throwable>
R`
`accept(ClassFile.ConstantElementValue.Visitor<R,EX> visitor)`
Invokes the respective method of the `ClassFile.ConstantElementValue.Visitor`.
`<R, EX extends Throwable>
R`
`accept(ClassFile.ElementValue.Visitor<R,EX> visitor)`
Invokes the respective method of the `ClassFile.ElementValue.Visitor`.
`byte`
`getTag()`
`void`
`store(DataOutputStream dos)`
Writes this element value in an element-value-type dependent way; see JVMS8 4.7.16.1.

### Methods inherited from class java.lang.Object

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

## Field Details

### constantValueIndex

public final short constantValueIndex
The index of the constant pool entry that holds the constant value for this annotation element.

## Constructor Details

### ConstantElementValue

public ConstantElementValue(byte tag, short constantValueIndex)

## Method Details

### getTag

public byte getTag()

Specified by:
  `getTag` in interface `ClassFile.ElementValue`
Returns:
  The "tag" byte to use when storing this "value" in an "element_value" structure

### store

public void store(DataOutputStream dos) throws IOException
Description copied from interface: `ClassFile.ElementValue`
Writes this element value in an element-value-type dependent way; see JVMS8 4.7.16.1. The "tag" byte is snot part of this writing!

Specified by:
  `store` in interface `ClassFile.ElementValue`
Throws:
  `IOException`

### accept

@Nullable public <R, EX extends Throwable> R accept(ClassFile.ElementValue.Visitor<R,EX> visitor) throws EX
Description copied from interface: `ClassFile.ElementValue`
Invokes the respective method of the `ClassFile.ElementValue.Visitor`.

Specified by:
  `accept` in interface `ClassFile.ElementValue`
Throws:
  `EX`

### accept

@Nullable protected abstract <R, EX extends Throwable> R accept(ClassFile.ConstantElementValue.Visitor<R,EX> visitor) throws EX
Invokes the respective method of the `ClassFile.ConstantElementValue.Visitor`.

Throws:
  `EX`