Top Description Methods
java.lang.classfile.attribute

public sealed Interface NestHostAttribute

extends Attribute<NestHostAttribute>, ClassElement
Known Direct Implementers
jdk.internal.classfile.impl.BoundAttribute.BoundNestHostAttribute, jdk.internal.classfile.impl.UnboundAttribute.UnboundNestHostAttribute
Annotations
@PreviewFeature
feature:CLASSFILE_API
Imports
java.lang.constant.ClassDesc, java.lang.classfile.Attribute, .ClassElement, java.lang.classfile.constantpool.ClassEntry, jdk.internal.classfile.impl.BoundAttribute, .TemporaryConstantPool, .UnboundAttribute, jdk.internal.javac.PreviewFeature

Preview

Second Preview of ClassFile API (JEP 466).

Programs can only use NestHostAttribute 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 NestHost attribute 4.7.28, which can appear on classes to indicate that this class is a member of a nest. 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 11.

Since
22

Method Summary

Modifier and TypeMethod and Description
public ClassEntry

Returns:

the host class of the nest to which this class belongs
nestHost
()

Returns the host class of the nest to which this class belongs.

public static NestHostAttribute

Returns:

a NestHost attribute
of
(ClassEntry
the host class of the nest
nestHost
)

Returns a NestHost attribute.

public static NestHostAttribute

Returns:

a NestHost attribute
of
(ClassDesc
the host class of the nest
nestHost
)

Returns a NestHost attribute.

Inherited from java.lang.classfile.Attribute:
attributeMapperattributeName

Method Detail

nestHostback to summary
public ClassEntry nestHost()

Returns the host class of the nest to which this class belongs.

Returns:ClassEntry

the host class of the nest to which this class belongs

ofback to summary
public static NestHostAttribute of(ClassEntry nestHost)

Returns a NestHost attribute.

Parameters
nestHost:ClassEntry

the host class of the nest

Returns:NestHostAttribute

a NestHost attribute

ofback to summary
public static NestHostAttribute of(ClassDesc nestHost)

Returns a NestHost attribute.

Parameters
nestHost:ClassDesc

the host class of the nest

Returns:NestHostAttribute

a NestHost attribute

Exceptions
IllegalArgumentException:
if nestHost represents a primitive type