APIdia Launch Partner
Top Description Fields Methods
java.lang.classfile.constantpool

public sealed Interface PackageEntry

extends PoolEntry
permits PackageEntryImpl
Known Direct Implementers
jdk.internal.classfile.impl.AbstractPoolEntry.PackageEntryImpl
Imports
java.lang.constant.PackageDesc, jdk.internal.classfile.impl.AbstractPoolEntry

Models a CONSTANT_Package_info, representing a package, in the constant pool of a class file.

The use of a PackageEntry is represented by a PackageDesc that does not represent the unnamed package. Conversions are through ConstantPoolBuilder#packageEntry(PackageDesc) and asSymbol().

A package entry is composite:

PackageEntry(Utf8Entry name)
PackageEntry(Utf8Entry name)
where name is the internal form of a binary package name and is not empty.
Since
24
Java Virtual Machine Specification
4.4.12 The CONSTANT_Package_info Structure

Field Summary

Inherited from java.lang.classfile.constantpool.PoolEntry:
TAG_CLASSTAG_DOUBLETAG_DYNAMICTAG_FIELDREFTAG_FLOATTAG_INTEGERTAG_INTERFACE_METHODREFTAG_INVOKE_DYNAMICTAG_LONGTAG_METHOD_HANDLETAG_METHOD_TYPETAG_METHODREFTAG_MODULETAG_NAME_AND_TYPETAG_PACKAGETAG_STRINGTAG_UTF8

Method Summary

Modifier and TypeMethod and Description
public PackageDesc

Returns:

a symbolic descriptor for the package name
asSymbol
()

Returns a symbolic descriptor for the package name.

public boolean

Returns:

whether this entry describes the given package
matches
(PackageDesc
the package descriptor
desc
)

Returns whether this entry describes the given package.

public Utf8Entry

Returns:

the internal form of the package name
name
()

Returns the internal form of the package name.

Inherited from java.lang.classfile.constantpool.PoolEntry:
constantPoolindextagwidth

Method Detail

asSymbolback to summary
public PackageDesc asSymbol()

Returns a symbolic descriptor for the package name.

API Note

If only symbol equivalence is desired, matches should be used. It requires reduced parsing and can improve class file reading performance.

Returns:PackageDesc

a symbolic descriptor for the package name

matchesback to summary
public boolean matches(PackageDesc desc)

Returns whether this entry describes the given package.

Parameters
desc:PackageDesc

the package descriptor

Returns:boolean

whether this entry describes the given package

Since
25
nameback to summary
public Utf8Entry name()

Returns the internal form of the package name.

Returns:Utf8Entry

the internal form of the package name