Spec-Zone.ru › OpenJDK 27

Interface Attribute<A extends Attribute<A>>

Type Parameters:
A - the attribute type
All Superinterfaces:
ClassFileElement
All Known Subinterfaces:
AnnotationDefaultAttribute, BootstrapMethodsAttribute, CharacterRangeTableAttribute, CodeAttribute, CompilationIDAttribute, ConstantValueAttribute, DeprecatedAttribute, EnclosingMethodAttribute, ExceptionsAttribute, InnerClassesAttribute, LineNumberTableAttribute, LocalVariableTableAttribute, LocalVariableTypeTableAttribute, MethodParametersAttribute, ModuleAttribute, ModuleHashesAttribute, ModuleMainClassAttribute, ModulePackagesAttribute, ModuleResolutionAttribute, ModuleTargetAttribute, NestHostAttribute, NestMembersAttribute, PermittedSubclassesAttribute, RecordAttribute, RuntimeInvisibleAnnotationsAttribute, RuntimeInvisibleParameterAnnotationsAttribute, RuntimeInvisibleTypeAnnotationsAttribute, RuntimeVisibleAnnotationsAttribute, RuntimeVisibleParameterAnnotationsAttribute, RuntimeVisibleTypeAnnotationsAttribute, SignatureAttribute, SourceDebugExtensionAttribute, SourceFileAttribute, SourceIDAttribute, StackMapTableAttribute, SyntheticAttribute, UnknownAttribute
All Known Implementing Classes:
CustomAttribute
public sealed interface Attribute<A extends Attribute<A>> extends ClassFileElement permits AnnotationDefaultAttribute, BootstrapMethodsAttribute, CharacterRangeTableAttribute, CodeAttribute, CompilationIDAttribute, ConstantValueAttribute, DeprecatedAttribute, EnclosingMethodAttribute, ExceptionsAttribute, InnerClassesAttribute, LineNumberTableAttribute, LocalVariableTableAttribute, LocalVariableTypeTableAttribute, MethodParametersAttribute, ModuleAttribute, ModuleHashesAttribute, ModuleMainClassAttribute, ModulePackagesAttribute, ModuleResolutionAttribute, ModuleTargetAttribute, NestHostAttribute, NestMembersAttribute, PermittedSubclassesAttribute, RecordAttribute, RuntimeInvisibleAnnotationsAttribute, RuntimeInvisibleParameterAnnotationsAttribute, RuntimeInvisibleTypeAnnotationsAttribute, RuntimeVisibleAnnotationsAttribute, RuntimeVisibleParameterAnnotationsAttribute, RuntimeVisibleTypeAnnotationsAttribute, SignatureAttribute, SourceDebugExtensionAttribute, SourceFileAttribute, SourceIDAttribute, StackMapTableAttribute, SyntheticAttribute, UnknownAttribute, CustomAttribute<T> (not exhaustive)
Models an attribute (JVMS §4.7) in the class file format. Attributes exist on certain class file structures modeled by AttributedElement, which provides basic read access to the attributes.

This sealed interface hierarchy includes attributes predefined in the JVMS and JDK-specific nonstandard attributes. Their mappers are available in Attributes. Two special subtypes of Attribute are CustomAttribute, which all user-defined attributes should extend from, and UnknownAttribute, representing attributes read from class file but are not recognized by the ClassFile.AttributeMapperOption.

Attributes are read through AttributedElement or element traversal of a CompoundElement; they are written through ClassFileBuilder. See Reading Attributes and Writing Attributes for more details.

See Java Virtual Machine Specification:
4.7 Attributes
Sealed Class Hierarchy Graph:
Sealed class hierarchy graph for AttributeSealed class hierarchy graph for Attribute
Since:
24
See Also:
  • java.lang.classfile.attribute
  • AttributeMapper
  • AttributedElement
  • CustomAttribute
  • UnknownAttribute

Method Summary

Modifier and Type Method Description
AttributeMapper<A> attributeMapper()
Returns the AttributeMapper associated with this attribute.
Utf8Entry attributeName()
Returns the name of the attribute.

Method Details

attributeName

Utf8Entry attributeName()
Returns the name of the attribute. The string value of the name is equivalent to the value of attributeMapper().name().

If this attribute is read from a class file, this method returns the Utf8Entry indicating the attribute name in the class file.

Returns:
the name of the attribute

attributeMapper

AttributeMapper<A> attributeMapper()
Returns the AttributeMapper associated with this attribute.
Returns:
the AttributeMapper associated with this attribute

Report a bug or suggest an enhancement
For further API reference and developer documentation see the Java SE Documentation, which contains more detailed, developer-targeted descriptions with conceptual overviews, definitions of terms, workarounds, and working code examples. Other versions.
Java is a trademark or registered trademark of Oracle and/or its affiliates in the US and other countries.
Copyright © 1993, 2026, Oracle and/or its affiliates, 500 Oracle Parkway, Redwood Shores, CA 94065 USA.
All rights reserved. Use is subject to license terms and the documentation redistribution policy.

© 1993, 2025, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API