PoolEntry (Java SE 22 & JDK 22)
Description: declaration: module: java.base, package: java.lang.classfile.constantpool, interface: PoolEntry
Keywords: java.lang.classfile.constantpool.PoolEntry interface

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

# Interface PoolEntry

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

All Known Subinterfaces:
  `AnnotationConstantValueEntryPREVIEW`, `ClassEntryPREVIEW`, `ConstantDynamicEntryPREVIEW`, `ConstantValueEntryPREVIEW`, `DoubleEntryPREVIEW`, `DynamicConstantPoolEntryPREVIEW`, `FieldRefEntryPREVIEW`, `FloatEntryPREVIEW`, `IntegerEntryPREVIEW`, `InterfaceMethodRefEntryPREVIEW`, `InvokeDynamicEntryPREVIEW`, `LoadableConstantEntryPREVIEW`, `LongEntryPREVIEW`, `MemberRefEntryPREVIEW`, `MethodHandleEntryPREVIEW`, `MethodRefEntryPREVIEW`, `MethodTypeEntryPREVIEW`, `ModuleEntryPREVIEW`, `NameAndTypeEntryPREVIEW`, `PackageEntryPREVIEW`, `StringEntryPREVIEW`, `Utf8EntryPREVIEW`

public sealed interface PoolEntry extends WritableElementPREVIEW<PoolEntryPREVIEW> permits AnnotationConstantValueEntryPREVIEW, DynamicConstantPoolEntryPREVIEW, LoadableConstantEntryPREVIEW, MemberRefEntryPREVIEW, ModuleEntryPREVIEW, NameAndTypeEntryPREVIEW, PackageEntryPREVIEW
`PoolEntry` is a preview API of the Java platform.
Programs can only use `PoolEntry` when preview features are enabled.
Preview features may be removed in a future release, or upgraded to permanent features of the Java platform.
Models an entry in the constant pool of a classfile.

Sealed Class Hierarchy Graph:
Since:
  22

- ## Method Summary

  Modifier and Type
  Method
  Description
  `ConstantPoolPREVIEW`
  `constantPool()`
  Returns the constant pool this entry is from.
  `int`
  `index()`
  Returns the index within the constant pool corresponding to this entry.
  `byte`
  `tag()`
  Returns the constant pool tag that describes the type of this entry.
  `int`
  `width()`
  Returns the number of constant pool slots this entry consumes.

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

  `writeTo`

- ## Method Details

  - ### constantPool

    ConstantPoolPREVIEW constantPool()
    Returns the constant pool this entry is from.
    Returns:
      the constant pool this entry is from

  - ### tag

    byte tag()
    Returns the constant pool tag that describes the type of this entry.
    Returns:
      the constant pool tag that describes the type of this entry

  - ### index

    int index()
    Returns the index within the constant pool corresponding to this entry.
    Returns:
      the index within the constant pool corresponding to this entry

  - ### width

    int width()
    Returns the number of constant pool slots this entry consumes.
    Returns:
      the number of constant pool slots this entry consumes