Top Description Methods
org.osgi.annotation.bundle

public @Interface Attribute

extends Annotation
Annotations
@Documented
@Retention:CLASS
@Target:METHOD
Imports
java.lang.annotation.Documented, .ElementType, .Retention, .RetentionPolicy, .Target

Mark an annotation element as an attribute.

This is used when applying Capability or Requirement as a meta annotation to an annotation declaration. The value of the annotation element annotated with Attribute 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 the MyCapability annotation, which is meta annotated with the Capability and Attribute annotations, will result in a capability in the namespace my.namespace with the attribute attr=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 the attr attribute in the generated capability.

This annotation is not retained at runtime. It is for use by tools to generate bundle manifests.

Author
$Id: 126200a2e0f44e2a27bb8c43232d4b4386cc02dd $

Method Summary

Modifier and TypeMethod and Description
public String
value()

The name of the attribute.

Inherited from java.lang.annotation.Annotation:
annotationTypeequalshashCodetoString

Method Detail

valueback to summary
public String value()

The name of the attribute.

If not specified, the name of the annotated element is used as the name of the attribute.