Top Description Fields Constructors Methods
java.lang.classfile

public abstract non-sealed Class CustomAttribute<T extends CustomAttribute<T>>

extends Object
implements Attribute<T extends CustomAttribute<T>>, CodeElement, ClassElement, MethodElement, FieldElement
Class Inheritance
All Implemented Interfaces
java.lang.classfile.FieldElement, java.lang.classfile.ClassFileElement, java.lang.classfile.MethodElement, java.lang.classfile.ClassElement, java.lang.classfile.CodeElement, java.lang.classfile.Attribute, java.lang.classfile.WritableElement
Annotations
@PreviewFeature
feature:CLASSFILE_API
Type Parameters
<T>
the custom attribute type
Imports
jdk.internal.javac.PreviewFeature

Preview

Second Preview of ClassFile API (JEP 466).

Programs can only use CustomAttribute when preview features are enabled.
Preview features may be removed in a future release, or upgraded to permanent features of the Java platform.

Models a non-standard attribute of a classfile. Clients should extend this class to provide an implementation class for non-standard attributes, and provide an AttributeMapper to mediate between the classfile format and the CustomAttribute representation.
Since
22

Field Summary

Modifier and TypeField and Description
private final AttributeMapper<T>

Constructor Summary

AccessConstructor and Description
protected
CustomAttribute(AttributeMapper<T>
the attribute mapper
mapper
)

Construct a CustomAttribute.

Method Summary

Modifier and TypeMethod and Description
public final AttributeMapper<T>
attributeMapper()

Implements java.lang.classfile.Attribute.attributeMapper.

Returns the AttributeMapper associated with this attribute.

public final String
attributeName()

Implements java.lang.classfile.Attribute.attributeName.

Returns the name of the attribute.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

public final void
writeTo(BufWriter
the writer
buf
)

Implements java.lang.classfile.WritableElement.writeTo.

Writes the element to the specified writer

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

mapperback to summary
private final AttributeMapper<T> mapper

Constructor Detail

CustomAttributeback to summary
protected CustomAttribute(AttributeMapper<T> mapper)

Construct a CustomAttribute.

Parameters
mapper:AttributeMapper<T>

the attribute mapper

Method Detail

attributeMapperback to summary
public final AttributeMapper<T> attributeMapper()

Implements java.lang.classfile.Attribute.attributeMapper.

Doc from java.lang.classfile.Attribute.attributeMapper.

Returns the AttributeMapper associated with this attribute.

Returns:AttributeMapper<T>

the AttributeMapper associated with this attribute

Annotations
@Override
attributeNameback to summary
public final String attributeName()

Implements java.lang.classfile.Attribute.attributeName.

Doc from java.lang.classfile.Attribute.attributeName.

Returns the name of the attribute.

Returns:String

the name of the attribute

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override
writeToback to summary
public final void writeTo(BufWriter buf)

Implements java.lang.classfile.WritableElement.writeTo.

Doc from java.lang.classfile.WritableElement.writeTo.

Writes the element to the specified writer

Parameters
buf:BufWriter

the writer

Annotations
@Override
@SuppressWarnings:unchecked