Package Summary Overview Summary

Module java.base
Package java.lang.classfile.constantpoolPREVIEW

# Interface ConstantValueEntry

All Superinterfaces:
  `ClassFileElementPREVIEW`, `LoadableConstantEntryPREVIEW`, `PoolEntryPREVIEW`, `WritableElementPREVIEW<PoolEntryPREVIEW>`

All Known Subinterfaces:
  `DoubleEntryPREVIEW`, `FloatEntryPREVIEW`, `IntegerEntryPREVIEW`, `LongEntryPREVIEW`, `StringEntryPREVIEW`

public sealed interface ConstantValueEntry extends LoadableConstantEntryPREVIEW permits DoubleEntryPREVIEW, FloatEntryPREVIEW, IntegerEntryPREVIEW, LongEntryPREVIEW, StringEntryPREVIEW
`ConstantValueEntry` is a preview API of the Java platform.
Programs can only use `ConstantValueEntry` when preview features are enabled.
Preview features may be removed in a future release, or upgraded to permanent features of the Java platform.
Models a constant pool entry that can be used as the constant in a `ConstantValue` attribute; this includes the four primitive constant types and String constants.

Sealed Class Hierarchy Graph:
Since:
  22

- ## Method Summary

  Modifier and Type
  Method
  Description
  `ConstantDesc`
  `constantValue()`
  Returns the constant value.

  ### Methods declared in interface java.lang.classfile.constantpool.LoadableConstantEntryPREVIEW

  `typeKind`

  ### Methods declared in interface java.lang.classfile.constantpool.PoolEntryPREVIEW

  `constantPool, index, tag, width`

  ### Methods declared in interface java.lang.classfile.WritableElementPREVIEW

  `writeTo`

- ## Method Details

  - ### constantValue

    ConstantDesc constantValue()
    Returns the constant value. The constant value will be an `Integer`, `Long`, `Float`, `Double`, or `String`.
    Specified by:
      `constantValue` in interface `LoadableConstantEntryPREVIEW`
    Returns:
      the constant value