Top Description Methods
java.lang.classfile.attribute

public sealed Interface ModulePackagesAttribute

extends Attribute<ModulePackagesAttribute>, ClassElement
Known Direct Implementers
jdk.internal.classfile.impl.BoundAttribute.BoundModulePackagesAttribute, jdk.internal.classfile.impl.UnboundAttribute.UnboundModulePackagesAttribute
Annotations
@PreviewFeature
feature:CLASSFILE_API
Imports
java.lang.classfile.Attribute, .ClassElement, jdk.internal.classfile.impl.BoundAttribute, .TemporaryConstantPool, .UnboundAttribute, java.util.Arrays, .List, java.lang.classfile.constantpool.PackageEntry, java.lang.constant.PackageDesc, jdk.internal.javac.PreviewFeature

Preview

Second Preview of ClassFile API (JEP 466).

Programs can only use ModulePackagesAttribute when preview features are enabled.
Preview features may be removed in a future release, or upgraded to permanent features of the Java platform.

Models the ModulePackages attribute 4.7.26, which can appear on classes that represent module descriptors. Delivered as a java.lang.classfile.ClassElement when traversing the elements of a java.lang.classfile.ClassModel.

The attribute does not permit multiple instances in a given location. Subsequent occurrence of the attribute takes precedence during the attributed element build or transformation.

The attribute was introduced in the Java SE Platform version 9.

Since
22

Method Summary

Modifier and TypeMethod and Description
public static ModulePackagesAttribute

Returns:

a ModulePackages attribute
of
(List<PackageEntry>
the packages
packages
)

Returns a ModulePackages attribute.

public static ModulePackagesAttribute

Returns:

a ModulePackages attribute
of
(PackageEntry...
the packages
packages
)

Returns a ModulePackages attribute.

public static ModulePackagesAttribute

Returns:

a ModulePackages attribute
ofNames
(List<PackageDesc>
the packages
packages
)

Returns a ModulePackages attribute.

public static ModulePackagesAttribute

Returns:

a ModulePackages attribute
ofNames
(PackageDesc...
the packages
packages
)

Returns a ModulePackages attribute.

public List<PackageEntry>

Returns:

the packages that are opened or exported by this module
packages
()

Returns the packages that are opened or exported by this module.

Inherited from java.lang.classfile.Attribute:
attributeMapperattributeName

Method Detail

ofback to summary
public static ModulePackagesAttribute of(List<PackageEntry> packages)

Returns a ModulePackages attribute.

Parameters
packages:List<PackageEntry>

the packages

Returns:ModulePackagesAttribute

a ModulePackages attribute

ofback to summary
public static ModulePackagesAttribute of(PackageEntry... packages)

Returns a ModulePackages attribute.

Parameters
packages:PackageEntry[]

the packages

Returns:ModulePackagesAttribute

a ModulePackages attribute

ofNamesback to summary
public static ModulePackagesAttribute ofNames(List<PackageDesc> packages)

Returns a ModulePackages attribute.

Parameters
packages:List<PackageDesc>

the packages

Returns:ModulePackagesAttribute

a ModulePackages attribute

ofNamesback to summary
public static ModulePackagesAttribute ofNames(PackageDesc... packages)

Returns a ModulePackages attribute.

Parameters
packages:PackageDesc[]

the packages

Returns:ModulePackagesAttribute

a ModulePackages attribute

packagesback to summary
public List<PackageEntry> packages()

Returns the packages that are opened or exported by this module.

Returns:List<PackageEntry>

the packages that are opened or exported by this module