APIdia Launch Partner
Top Description Methods
java.lang.constant

public sealed Interface PackageDesc

permits PackageDescImpl
Known Direct Implementers
jdk.internal.constant.PackageDescImpl
Imports
jdk.internal.constant.ConstantUtils, .PackageDescImpl

A nominal descriptor for a Package constant.

To create a PackageDesc for a package, use the of(String) or ofInternalName(String) method.

Since
21
Java Virtual Machine Specification
4.4.12 The CONSTANT_Package_info Structure

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

whether this descriptor is equal to the other object
equals
(Object
the other object
o
)

Compare the specified object with this descriptor for equality.

public String

Returns:

the package name in internal form, or the empty string for the unnamed package
internalName
()

Returns the fully qualified (slash-separated) package name in internal form of this PackageDesc.

public default String

Returns:

the package name, or the empty string for the unnamed package
name
()

Returns the fully qualified (dot-separated) package name of this PackageDesc.

public static PackageDesc

Returns:

a PackageDesc describing the desired package
of
(String
the fully qualified (dot-separated) package name
name
)

Returns a PackageDesc for a package, given the name of the package, such as "java.lang".

public static PackageDesc

Returns:

a PackageDesc describing the desired package
ofInternalName
(String
the fully qualified package name, in internal (slash-separated) form
name
)

Returns a PackageDesc for a package, given the name of the package in internal form, such as "java/lang".

Method Detail

equalsback to summary
public boolean equals(Object o)

Compare the specified object with this descriptor for equality. Returns true if and only if the specified object is also a PackageDesc and both describe the same package.

Parameters
o:Object

the other object

Returns:boolean

whether this descriptor is equal to the other object

Annotations
@Override
internalNameback to summary
public String internalName()

Returns the fully qualified (slash-separated) package name in internal form of this PackageDesc.

Returns:String

the package name in internal form, or the empty string for the unnamed package

See Also
PackageDesc#name()
nameback to summary
public default String name()

Returns the fully qualified (dot-separated) package name of this PackageDesc.

Returns:String

the package name, or the empty string for the unnamed package

See Also
PackageDesc#internalName()
ofback to summary
public static PackageDesc of(String name)

Returns a PackageDesc for a package, given the name of the package, such as "java.lang".

Parameters
name:String

the fully qualified (dot-separated) package name

Returns:PackageDesc

a PackageDesc describing the desired package

Exceptions
NullPointerException:
if the argument is null
IllegalArgumentException:
if the name string is not in the correct format
Java Language Specification
6.5.3 Meaning of Module Names and Package Names
See Also
PackageDesc#ofInternalName(String)
ofInternalNameback to summary
public static PackageDesc ofInternalName(String name)

Returns a PackageDesc for a package, given the name of the package in internal form, such as "java/lang".

Parameters
name:String

the fully qualified package name, in internal (slash-separated) form

Returns:PackageDesc

a PackageDesc describing the desired package

Exceptions
NullPointerException:
if the argument is null
IllegalArgumentException:
if the name string is not in the correct format
Java Virtual Machine Specification
4.2.1 Binary Class and Interface Names, 4.2.3 Module and Package Names
See Also
PackageDesc#of(String)