APIdia Launch Partner
Top Description Methods
java.lang.classfile.attribute

public sealed Interface NestHostAttribute

extends Attribute<NestHostAttribute>, ClassElement
permits BoundNestHostAttribute, UnboundNestHostAttribute
Known Direct Implementers
jdk.internal.classfile.impl.BoundAttribute.BoundNestHostAttribute, jdk.internal.classfile.impl.UnboundAttribute.UnboundNestHostAttribute
Imports
java.lang.classfile.Attribute, .AttributeMapper, .AttributeMapper.AttributeStability, .Attributes, .ClassElement, .ClassFile, java.lang.classfile.constantpool.ClassEntry, java.lang.constant.ClassDesc, jdk.internal.classfile.impl.BoundAttribute, .TemporaryConstantPool, .UnboundAttribute

Models the NestHost attribute (JVMS 4.7.28), which indicates this class is a member of a nest and the host class of the nest.

This attribute only appears on classes, and does not permit multiple instances in a class. It has a data dependency on the constant pool.

The attribute was introduced in the Java SE Platform version 11, major version 55.

Since
24
Java Virtual Machine Specification
4.7.28 The NestHost Attribute
See Also
Attributes#nestHost(), NestMembersAttribute, Class#getNestHost(), Class#isNestmateOf(Class)

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

See Also
Class#getNestHost()
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