Module java.base
Package java.lang.classfile

# Interface AttributedElement

≠
public abstract sealed interface AttributedElement
extends java.lang.classfile.ClassFileElement
permits java.lang.classfile.ClassModel, java.lang.classfile.CodeModel, java.lang.classfile.FieldModel, java.lang.classfile.MethodModel, java.lang.classfile.attribute.RecordComponentInfo, jdk.internal.classfile.impl.AbstractUnboundModel<E>

## Methods

- ≠
  public abstract java.util.List<java.lang.classfile.Attribute<?>> attributes()
  Comparing jdk-master and valhalla-csr-open

  ### attributes

  List<AttributePREVIEW <?>> attributes()
  Returns the attributes of this structure.
  Returns:
    the attributes of this structure
- ≠
  public default <T> java.util.Optional<T> findAttribute(java.lang.classfile.AttributeMapper<T> arg0)
  Comparing jdk-master and valhalla-csr-open

  ### findAttribute

  default <T extends AttributePREVIEW <T>> Optional<T> findAttribute (AttributeMapper<T> attr)
  Finds an attribute by name. This is suitable to find attributes that allow at most one instance in one structure. If this is used to find attributes that allow multiple instances in one structure, the first matching instance is returned.
  API Note:
    This can easily find an attribute and send it to another `ClassFileBuilder` , which is a `Consumer` :

        MethodModel method = ...
        MethodBuilder mb = ...
        method.findAttribute(Attributes.code()).ifPresent(mb);

  Type Parameters:
    `T` - the type of the attribute
  Parameters:
    `attr` - the attribute mapper
  Returns:
    the attribute, or `Optional.empty()` if the attribute is not present
- ≠
  public default <T> java.util.List<T> findAttributes(java.lang.classfile.AttributeMapper<T> arg0)
  Comparing jdk-master and valhalla-csr-open

  ### findAttributes

  default <T extends AttributePREVIEW <T>> List<T> findAttributes (AttributeMapper<T> attr)
  Finds attributes by name. This is suitable to find attributes that allow multiple instances in one structure.
  Type Parameters:
    `T` - the type of the attribute
  Parameters:
    `attr` - the attribute mapper
  Returns:
    the attributes, or an empty `List` if the attribute is not present

## Summary

Differences
| Elements | Comments | Descriptions | Total
Added | Changed | Removed | Added | Changed | Removed | Added | Changed | Removed
--- | --- | --- | --- | --- | --- | --- | --- | ---
attributes() |  |  |  |  |  |  | 1 |  |  | 1
findAttribute(AttributeMapper) |  |  |  |  |  |  | 1 |  |  | 1
findAttributes(AttributeMapper) |  |  |  |  |  |  | 1 |  |  | 1
Total |  |  |  |  |  |  | 3 |  |  | 3