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

public sealed Interface RecordAttribute

extends Attribute<RecordAttribute>, ClassElement
permits BoundRecordAttribute, UnboundRecordAttribute
Known Direct Implementers
jdk.internal.classfile.impl.BoundAttribute.BoundRecordAttribute, jdk.internal.classfile.impl.UnboundAttribute.UnboundRecordAttribute
Imports
java.lang.classfile.Attribute, .AttributeMapper, .AttributeMapper.AttributeStability, .Attributes, .ClassElement, .ClassFile, java.util.List, jdk.internal.classfile.impl.BoundAttribute, .UnboundAttribute

Models the Record attribute (JVMS 4.7.30), which indicates that this class is a record class and the record components.

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 16, major version 60.

Since
24
Java Virtual Machine Specification
4.7.30 The Record Attribute
See Also
Attributes#record(), Class#isRecord(), Class#getRecordComponents()

Method Summary

Modifier and TypeMethod and Description
public List<RecordComponentInfo>

Returns:

the components of this record class
components
()

Returns the components of this record class.

public static RecordAttribute

Returns:

a Record attribute
of
(List<RecordComponentInfo>
the record components
components
)

Returns a Record attribute.

public static RecordAttribute

Returns:

a Record attribute
of
(RecordComponentInfo...
the record components
components
)

Returns a Record attribute.

Inherited from java.lang.classfile.Attribute:
attributeMapperattributeName

Method Detail

componentsback to summary
public List<RecordComponentInfo> components()

Returns the components of this record class.

Returns:List<RecordComponentInfo>

the components of this record class

See Also
Class#getRecordComponents()
ofback to summary
public static RecordAttribute of(List<RecordComponentInfo> components)

Returns a Record attribute.

Parameters
components:List<RecordComponentInfo>

the record components

Returns:RecordAttribute

a Record attribute

Exceptions
IllegalArgumentException:
if the number of record components exceeds the limit of u2
ofback to summary
public static RecordAttribute of(RecordComponentInfo... components)

Returns a Record attribute.

Parameters
components:RecordComponentInfo[]

the record components

Returns:RecordAttribute

a Record attribute

Exceptions
IllegalArgumentException:
if the number of record components exceeds the limit of u2