| •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 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 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 |
|
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
Class<?> value(); |
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
@Directive |
| 64 |
String effective() default ""; |
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
|
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
String cardinality() default Cardinality.DEFAULT; |
| 76 |
|
| 77 |
|
| 78 |
|
| 79 |
|
| 80 |
|
| 81 |
|
| 82 |
|
| 83 |
|
| 84 |
|
| 85 |
|
| 86 |
|
| 87 |
|
| 88 |
String resolution() default Resolution.DEFAULT; |
| 89 |
|
| 90 |
} |