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

# Interface PackageEntry

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

public sealed interface PackageEntry extends PoolEntryPREVIEW
`PackageEntry` is a preview API of the Java platform.
Programs can only use `PackageEntry` 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_Package_info` constant in the constant pool of a classfile.

See Java Virtual Machine Specification:
  4.4.12 The CONSTANT_Package_info Structure
Since:
  22

- ## Method Summary

  Modifier and Type
  Method
  Description
  `PackageDesc`
  `asSymbol()`
  Returns a symbolic descriptor for the package name.
  `Utf8EntryPREVIEW`
  `name()`
  Returns the package name.

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

  `constantPool, index, tag, width`

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

  `writeTo`

- ## Method Details

  - ### name

    Utf8EntryPREVIEW name()
    Returns the package name.
    Returns:
      the package name

  - ### asSymbol

    PackageDesc asSymbol()
    Returns a symbolic descriptor for the package name.
    Returns:
      a symbolic descriptor for the package name