< prev index next >

src/java.base/share/classes/java/lang/classfile/Attribute.java

Print this page

33 /**
34  * Models a classfile attribute (JVMS {@jvms 4.7}).  Many, though not all, subtypes of
35  * {@linkplain Attribute} will implement {@link ClassElement}, {@link
36  * MethodElement}, {@link FieldElement}, or {@link CodeElement}; attributes that
37  * are also elements will be delivered when traversing the elements of the
38  * corresponding model type. Additionally, all attributes are accessible
39  * directly from the corresponding model type through {@link
40  * AttributedElement#findAttribute(AttributeMapper)}.
41  * @param <A> the attribute type
42  *
43  * @sealedGraph
44  * @since 22
45  */
46 @PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
47 public sealed interface Attribute<A extends Attribute<A>>
48         extends ClassFileElement
49         permits AnnotationDefaultAttribute, BootstrapMethodsAttribute,
50                 CharacterRangeTableAttribute, CodeAttribute, CompilationIDAttribute,
51                 ConstantValueAttribute, DeprecatedAttribute, EnclosingMethodAttribute,
52                 ExceptionsAttribute, InnerClassesAttribute, LineNumberTableAttribute,
53                 LocalVariableTableAttribute, LocalVariableTypeTableAttribute,
54                 MethodParametersAttribute, ModuleAttribute, ModuleHashesAttribute,
55                 ModuleMainClassAttribute, ModulePackagesAttribute, ModuleResolutionAttribute,
56                 ModuleTargetAttribute, NestHostAttribute, NestMembersAttribute,
57                 PermittedSubclassesAttribute,
58                 RecordAttribute, RuntimeInvisibleAnnotationsAttribute,
59                 RuntimeInvisibleParameterAnnotationsAttribute, RuntimeInvisibleTypeAnnotationsAttribute,
60                 RuntimeVisibleAnnotationsAttribute, RuntimeVisibleParameterAnnotationsAttribute,
61                 RuntimeVisibleTypeAnnotationsAttribute, SignatureAttribute,
62                 SourceDebugExtensionAttribute, SourceFileAttribute, SourceIDAttribute,
63                 StackMapTableAttribute, SyntheticAttribute,
64                 UnknownAttribute, BoundAttribute, UnboundAttribute, CustomAttribute {
65     /**
66      * {@return the name of the attribute}
67      */
68     String attributeName();
69 
70     /**
71      * {@return the {@link AttributeMapper} associated with this attribute}
72      */
73     AttributeMapper<A> attributeMapper();

33 /**
34  * Models a classfile attribute (JVMS {@jvms 4.7}).  Many, though not all, subtypes of
35  * {@linkplain Attribute} will implement {@link ClassElement}, {@link
36  * MethodElement}, {@link FieldElement}, or {@link CodeElement}; attributes that
37  * are also elements will be delivered when traversing the elements of the
38  * corresponding model type. Additionally, all attributes are accessible
39  * directly from the corresponding model type through {@link
40  * AttributedElement#findAttribute(AttributeMapper)}.
41  * @param <A> the attribute type
42  *
43  * @sealedGraph
44  * @since 22
45  */
46 @PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
47 public sealed interface Attribute<A extends Attribute<A>>
48         extends ClassFileElement
49         permits AnnotationDefaultAttribute, BootstrapMethodsAttribute,
50                 CharacterRangeTableAttribute, CodeAttribute, CompilationIDAttribute,
51                 ConstantValueAttribute, DeprecatedAttribute, EnclosingMethodAttribute,
52                 ExceptionsAttribute, InnerClassesAttribute, LineNumberTableAttribute,
53                 LoadableDescriptorsAttribute, LocalVariableTableAttribute, LocalVariableTypeTableAttribute,
54                 MethodParametersAttribute, ModuleAttribute, ModuleHashesAttribute,
55                 ModuleMainClassAttribute, ModulePackagesAttribute, ModuleResolutionAttribute,
56                 ModuleTargetAttribute, NestHostAttribute, NestMembersAttribute,
57                 PermittedSubclassesAttribute,
58                 RecordAttribute, RuntimeInvisibleAnnotationsAttribute,
59                 RuntimeInvisibleParameterAnnotationsAttribute, RuntimeInvisibleTypeAnnotationsAttribute,
60                 RuntimeVisibleAnnotationsAttribute, RuntimeVisibleParameterAnnotationsAttribute,
61                 RuntimeVisibleTypeAnnotationsAttribute, SignatureAttribute,
62                 SourceDebugExtensionAttribute, SourceFileAttribute, SourceIDAttribute,
63                 StackMapTableAttribute, SyntheticAttribute,
64                 UnknownAttribute, BoundAttribute, UnboundAttribute, CustomAttribute {
65     /**
66      * {@return the name of the attribute}
67      */
68     String attributeName();
69 
70     /**
71      * {@return the {@link AttributeMapper} associated with this attribute}
72      */
73     AttributeMapper<A> attributeMapper();
< prev index next >