T - the custom attribute typeAttribute<T>, ClassElement, ClassFileElement, CodeElement, FieldElement, MethodElementpublic abstract non-sealed class CustomAttribute<T extends CustomAttribute<T>> extends Object implements Attribute<T>, CodeElement, ClassElement, MethodElement, FieldElement
class file. API models for user-defined attributes should extend this class. A user-defined attribute should also have an AttributeMapper defined, which will be returned by attributeMapper(), and registered to the ClassFile.AttributeMapperOption so the user-defined attributes can be read. Accessor methods on user-defined attributes read from class files may throw IllegalArgumentException if the attribute model is lazily evaluated, and the evaluation encounters malformed class file format for the attribute.
| Modifier | Constructor | Description |
|---|---|---|
protected |
Constructor for subclasses to call. |
| Modifier and Type | Method | Description |
|---|---|---|
final AttributeMapper |
attributeMapper() |
Returns the AttributeMapper associated with this attribute. |
Utf8Entry |
attributeName() |
Returns the name of the attribute. |
protected CustomAttribute(AttributeMapper<T> mapper)
mapper - the attribute mapperpublic final AttributeMapper<T> attributeMapper()
AttributeAttributeMapper associated with this attribute.attributeMapper in interface Attribute<T extends CustomAttribute<T>>
AttributeMapper associated with this attributepublic Utf8Entry attributeName()
attributeMapper().name(). If this attribute is read from a class file, this method returns the Utf8Entry indicating the attribute name in the class file.
attributeName in interface Attribute<T extends CustomAttribute<T>>
Utf8Entry suitable for writing only, which may be unbound. Subclasses representing attributes read from class files must override this method.
© 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.
https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/classfile/CustomAttribute.html