@Documented
@Retention(value=CLASS)
@Target(value=METHOD)
public @interface Directive
This is used when applying Capability
or Requirement
as a
meta annotation to an annotation declaration. The value of the annotation
element annotated with Directive
is used as the value of a directive
in the generated capability or requirement clause. For example:
@Capability(namespace = "my.namespace") public @interface MyCapability { @Directive("resource") String value() default ""; } @MyCapability("foo") public MyClass {}The use of the
MyCapability
annotation, which is meta annotated with
the Capability
and Directive
annotations, will result in a
capability in the namespace my.namespace
with the directive
resource:=foo
.
If the element annotated with Directive
is unspecified when applied,
then the directive must not be generated in the generated capability or
requirement clause. For example:
@MyCapability public MyClass {}will not have the
resource
directive in the generated capability.
This annotation is not retained at runtime. It is for use by tools to generate bundle manifests.
Modifier and Type | Optional Element and Description |
---|---|
java.lang.String |
value
The name of the directive.
|
Copyright © OSGi Alliance (2000, 2018). All Rights Reserved. Licensed under the OSGi Specification License, Version 2.0