Package org.osgi.annotation.bundle
Annotation Type Attribute
-
@Documented @Retention(CLASS) @Target(METHOD) public @interface Attribute
Mark an annotation element as an attribute.This is used when applying
Capability
orRequirement
as a meta annotation to an annotation declaration. The value of the annotation element annotated withAttribute
is used as the value of an attribute in the generated capability or requirement clause. For example:@Capability(namespace = "my.namespace") public @interface MyCapability { @Attribute("attr") String value() default ""; } @MyCapability("foo") public MyClass {}
The use of theMyCapability
annotation, which is meta annotated with theCapability
andAttribute
annotations, will result in a capability in the namespacemy.namespace
with the attributeattr=foo
.If the element annotated with
Attribute
is unspecified when applied, then the attribute must not be generated in the generated capability or requirement clause. For example:@MyCapability public MyClass {}
will not have theattr
attribute in the generated capability.This annotation is not retained at runtime. It is for use by tools to generate bundle manifests.
-
-
Optional Element Summary
Optional Elements Modifier and Type Optional Element Description java.lang.String
value
The name of the attribute.
-