Debian Codegraph @

src/org/osgi/annotation/bundle/Directive.java

raw symbols ◀ ▶ SCIP
1 Debian patch touch this file
•1 /*******************************************************************************
2 * Copyright (c) Contributors to the Eclipse Foundation
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *
16 * SPDX-License-Identifier: Apache-2.0
17 *******************************************************************************/
18
19 package org.osgi.annotation.bundle;
20
21 import java.lang.annotation.Documented;
22 import java.lang.annotation.ElementType;
23 import java.lang.annotation.Retention;
24 import java.lang.annotation.RetentionPolicy;
25 import java.lang.annotation.Target;
26
27 /**
28 * Mark an annotation element as a directive.
29 * <p>
30 * This is used when applying {@link Capability} or {@link Requirement} as a
31 * meta annotation to an annotation declaration. The value of the annotation
32 * element annotated with {@code Directive} is used as the value of a directive
33 * in the generated capability or requirement clause. For example:
34 *
35 * <pre>
36 * &#64;Capability(namespace = "my.namespace")
37 * public &#64;interface MyCapability {
38 * &#64;Directive("resource")
39 * String value() default "";
40 * }
41 *
42 * &#64;MyCapability("foo")
43 * public MyClass {}
44 * </pre>
45 *
46 * The use of the {@code MyCapability} annotation, which is meta annotated with
47 * the {@code Capability} and {@code Directive} annotations, will result in a
48 * capability in the namespace {@code my.namespace} with the directive
49 * {@code resource:=foo}.
50 * <p>
51 * If the element annotated with {@code Directive} is unspecified when applied,
52 * then the directive must not be generated in the generated capability or
53 * requirement clause. For example:
54 *
55 * <pre>
56 * &#64;MyCapability
57 * public MyClass {}
58 * </pre>
59 *
60 * will not have the {@code resource} directive in the generated capability.
61 * <p>
62 * This annotation is not retained at runtime. It is for use by tools to
63 * generate bundle manifests.
64 *
65 * @author $Id: 3cb5691a604299a07e1f80e708f2201311d03f6c $
66 */
67 @Documented
68 @Retention(RetentionPolicy.CLASS)
69 @Target(ElementType.METHOD)
70 public @interface Directive {
71 /**
72 * The name of the directive.
73 * <p>
74 * If not specified, the name of the annotated element is used as the name
75 * of the directive.
76 */
77 String value() default "";
78 }