ClassFileElement describing a class file structure that has
attributes, such as a class file, a field, a method, a Code attribute, or a record component.
Unless otherwise specified, most attributes that can be discovered in a
CompoundElement implements the corresponding membership subinterface of ClassFileElement, and can be sent to a ClassFileBuilder to be
integrated into the built structure.
java.lang.classfile.attribute
| Modifier and Type | Method and Description |
|---|---|
| public List | |
| public default < the type of the attribute T extends Attribute | Returns: the attribute, orOptional.empty() if the attribute
is not presentthe attribute mapper attr)Finds an attribute by name. |
| public default < the type of the attribute T extends Attribute | Returns: the attributes, or an emptyList if the attribute
is not presentthe attribute mapper attr)Finds attributes by name. |
| attributes | back to summary |
|---|---|
| public List Returns the attributes of this structure. | |
| findAttribute | back to summary |
|---|---|
| public default <T extends Attribute 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 MethodModel method = ... MethodBuilder mb = ... method.findAttribute(Attributes.code()).ifPresent(mb);
| |
| findAttributes | back to summary |
|---|---|
| public default <T extends Attribute Finds attributes by name. This is suitable to find attributes that allow multiple instances in one structure.
| |