Package Summary Overview Summary

Module java.base
Package java.lang.classfilePREVIEW

# Class CustomAttribute<T extends CustomAttributePREVIEW<T>>

java.lang.Object
java.lang.classfile.CustomAttribute<T>

Type Parameters:
  `T` - the custom attribute type

All Implemented Interfaces:
  `AttributePREVIEW<T>`, `ClassElementPREVIEW`, `ClassFileElementPREVIEW`, `CodeElementPREVIEW`, `FieldElementPREVIEW`, `MethodElementPREVIEW`, `WritableElementPREVIEW<T>`

public abstract non-sealed class CustomAttribute<T extends CustomAttributePREVIEW<T>> extends Object implements AttributePREVIEW<T>, CodeElementPREVIEW, ClassElementPREVIEW, MethodElementPREVIEW, FieldElementPREVIEW
`CustomAttribute` is a preview API of the Java platform.
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`PREVIEW to mediate between the classfile format and the CustomAttributePREVIEW representation.

Since:
  22

- ## Constructor Summary

  Constructors
  Modifier
  Constructor
  Description
  `protected`
  `CustomAttribute (AttributeMapperPREVIEW<T> mapper)`
  Construct a CustomAttributePREVIEW.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `final AttributeMapperPREVIEW <T>`
  `attributeMapper()`
  Returns the `AttributeMapper`PREVIEW associated with this attribute.
  `final String`
  `attributeName()`
  Returns the name of the attribute.
  `final void`
  `writeTo (BufWriterPREVIEW buf)`
  Writes the element to the specified writer

  ### Methods declared in class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### CustomAttribute

    protected CustomAttribute (AttributeMapperPREVIEW<T> mapper)
    Construct a CustomAttributePREVIEW.
    Parameters:
      `mapper` - the attribute mapper

- ## Method Details

  - ### attributeMapper

    public final AttributeMapperPREVIEW<T> attributeMapper()
    Description copied from interface: `Attribute`
    Returns the `AttributeMapper`PREVIEW associated with this attribute.
    Specified by:
      `attributeMapper` in interface `AttributePREVIEW<T extends CustomAttributePREVIEW<T>>`
    Returns:
      the `AttributeMapper`PREVIEW associated with this attribute

  - ### attributeName

    public final String attributeName()
    Description copied from interface: `Attribute`
    Returns the name of the attribute.
    Specified by:
      `attributeName` in interface `AttributePREVIEW<T extends CustomAttributePREVIEW<T>>`
    Returns:
      the name of the attribute

  - ### writeTo

    public final void writeTo (BufWriterPREVIEW buf)
    Description copied from interface: `WritableElement`
    Writes the element to the specified writer
    Specified by:
      `writeTo` in interface `WritableElementPREVIEW<T extends CustomAttributePREVIEW<T>>`
    Parameters:
      `buf` - the writer