Debian Codegraph @

src/aQute/bnd/annotation/spi/ServiceConsumer.java

raw symbols ◀ ▶ SCIP
1 Debian patch touch this file
•1 package aQute.bnd.annotation.spi;
2
3 import static aQute.bnd.annotation.Constants.CARDINALITY_MACRO;
4 import static aQute.bnd.annotation.Constants.RESOLUTION_MACRO;
5 import static aQute.bnd.annotation.spi.Constants.SERVICELOADER_PROCESSOR;
6 import static aQute.bnd.annotation.spi.Constants.SERVICELOADER_VERSION;
7 import static aQute.bnd.annotation.spi.Constants.VALUE_MACRO;
8 import static java.lang.annotation.ElementType.PACKAGE;
9 import static java.lang.annotation.ElementType.TYPE;
10 import static java.lang.annotation.RetentionPolicy.CLASS;
11 import static org.osgi.namespace.extender.ExtenderNamespace.EXTENDER_NAMESPACE;
12 import static org.osgi.service.serviceloader.ServiceLoaderNamespace.SERVICELOADER_NAMESPACE;
13
14 import java.lang.annotation.Repeatable;
15 import java.lang.annotation.Retention;
16 import java.lang.annotation.Target;
17
18 import org.osgi.annotation.bundle.Directive;
19 import org.osgi.annotation.bundle.Requirement;
20
21 import aQute.bnd.annotation.Cardinality;
22 import aQute.bnd.annotation.Resolution;
23
24 /**
25 * Annotation used to generate requirements necessary for supporting the
26 * consumer side of the <em>Service Loader Mediator</em> specification.
27 *
28 * @see <a href=
29 * "https://osgi.org/specification/osgi.cmpn/7.0.0/service.loader.html">Service
30 * Loader Mediator</a>
31 */
32 @Repeatable(ServiceConsumers.class)
33 @Retention(CLASS)
34 @Target({
35 PACKAGE, TYPE
36 })
37 @Requirement(name = VALUE_MACRO, namespace = SERVICELOADER_NAMESPACE, attribute = {
38 SERVICELOADER_NAMESPACE + "=" + VALUE_MACRO, CARDINALITY_MACRO, RESOLUTION_MACRO
39 })
40 @Requirement(name = SERVICELOADER_PROCESSOR, namespace = EXTENDER_NAMESPACE, version = SERVICELOADER_VERSION, attribute = {
41 RESOLUTION_MACRO
42 })
43 public @interface ServiceConsumer {
44 /**
45 * The service <em>type</em>.
46 *
47 * @return the service type
48 */
49 Class<?> value();
50
51 /**
52 * The effective time of the {@code osgi.serviceloader} and
53 * {@code osgi.extender} requirements.
54 * <p>
55 * Specifies the time the service loader requirements are available. The
56 * OSGi framework resolver only considers requirements without an effective
57 * directive or {@code effective:=resolve}. Requirements with other values
58 * for the effective directive can be considered by an external agent.
59 * <p>
60 * If not specified, the {@code effective} directive is omitted from the
61 * requirement clause.
62 */
63 @Directive
64 String effective() default "";
65
66 /**
67 * The cardinality of this requirement.
68 * <p>
69 * Indicates if this requirement can be wired a single time or multiple
70 * times.
71 * <p>
72 * If not specified, the {@code cardinality} directive is omitted from the
73 * requirement clause.
74 */
75 String cardinality() default Cardinality.DEFAULT;
76
77 /**
78 * The resolution policy of the {@code osgi.serviceloader} and
79 * {@code osgi.extender} requirements.
80 * <p>
81 * A mandatory requirement forbids the bundle to resolve when this
82 * requirement is not satisfied; an optional requirement allows a bundle to
83 * resolve even if this requirement is not satisfied.
84 * <p>
85 * If not specified, the {@code resolution} directive is omitted from the
86 * requirement clause.
87 */
88 String resolution() default Resolution.DEFAULT;
89
90 }