FELIX-1010: Apply patch from Felix Meschberger:
@Property tag should be allowed on fields, too, for consistency with @scr.property and for ease of use
@ReferenceCardinality constants should have different names to more closely match
the description in the spec (112.3.2, Reference Cardinality)
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@765540 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/scrplugin-annotations/src/main/java/org/apache/felix/scrplugin/annotations/Component.java b/scrplugin-annotations/src/main/java/org/apache/felix/scrplugin/annotations/Component.java
index da93572..6be0f48 100644
--- a/scrplugin-annotations/src/main/java/org/apache/felix/scrplugin/annotations/Component.java
+++ b/scrplugin-annotations/src/main/java/org/apache/felix/scrplugin/annotations/Component.java
@@ -53,7 +53,7 @@
/**
* This is generally used as a description for the object described by the
* meta type. This name may be localized by prepending a % sign to the name.
- * Default value: %<name>.name
+ * Default value: %<name>.description
*/
String description() default "";
diff --git a/scrplugin-annotations/src/main/java/org/apache/felix/scrplugin/annotations/Property.java b/scrplugin-annotations/src/main/java/org/apache/felix/scrplugin/annotations/Property.java
index 4b90e6b..b2a2566 100644
--- a/scrplugin-annotations/src/main/java/org/apache/felix/scrplugin/annotations/Property.java
+++ b/scrplugin-annotations/src/main/java/org/apache/felix/scrplugin/annotations/Property.java
@@ -32,7 +32,7 @@
* declaration. See section 112.4.5, Properties and Property Elements, in the
* OSGi Service Platform Service Compendium Specification for more information.
*/
-@Target(ElementType.TYPE)
+@Target( { ElementType.TYPE, ElementType.FIELD })
@Retention(RetentionPolicy.SOURCE)
@Documented
public @interface Property {
@@ -68,7 +68,7 @@
* {@link Long}, {@link Double}, {@link Float}, {@link Integer},
* {@link Byte}, {@link Character}, {@link Boolean} and {@link Short}.
*/
- Class type() default AutoDetect.class;
+ Class<?> type() default AutoDetect.class;
/**
* Defines the cardinality of the property and its collection type. If the
diff --git a/scrplugin-annotations/src/main/java/org/apache/felix/scrplugin/annotations/Reference.java b/scrplugin-annotations/src/main/java/org/apache/felix/scrplugin/annotations/Reference.java
index 9d1ec6e..72e289b 100644
--- a/scrplugin-annotations/src/main/java/org/apache/felix/scrplugin/annotations/Reference.java
+++ b/scrplugin-annotations/src/main/java/org/apache/felix/scrplugin/annotations/Reference.java
@@ -51,13 +51,13 @@
* the annotation is declared for a field, the default value for the
* interface parameter is the type of the field.
*/
- Class referenceInterface() default AutoDetect.class;
+ Class<?> referenceInterface() default AutoDetect.class;
/**
* The cardinality of the service reference. This must be one of 0..1, 1..1,
* 0..n, and 1..n.
*/
- ReferenceCardinality cardinality() default ReferenceCardinality.ONE_TO_ONE;
+ ReferenceCardinality cardinality() default ReferenceCardinality.MANDATORY_UNARY;
/**
* The dynamicity policy of the reference. If dynamic the service will be
diff --git a/scrplugin-annotations/src/main/java/org/apache/felix/scrplugin/annotations/ReferenceCardinality.java b/scrplugin-annotations/src/main/java/org/apache/felix/scrplugin/annotations/ReferenceCardinality.java
index fea82f7..7705d5e 100644
--- a/scrplugin-annotations/src/main/java/org/apache/felix/scrplugin/annotations/ReferenceCardinality.java
+++ b/scrplugin-annotations/src/main/java/org/apache/felix/scrplugin/annotations/ReferenceCardinality.java
@@ -24,24 +24,32 @@
public enum ReferenceCardinality {
/**
- * Cardinality 0..1
+ * Optional, unary reference: No service required to be available for the
+ * refernce to be satisfied. Only a single service is available through this
+ * reference.
*/
- ZERO_TO_ONE("0..1"),
+ OPTIONAL_UNARY("0..1"),
/**
- * Cardinality 1..1
+ * Mandatory, unary reference: At least one service must be available for
+ * the reference to be satisfied. Only a single service is available through
+ * this reference.
*/
- ONE_TO_ONE("1..1"),
+ MANDATORY_UNARY("1..1"),
/**
- * Cardinality 0..n
+ * Optional, multiple reference: No service required to be available for the
+ * refernce to be satisfied. All matching services are available through
+ * this reference.
*/
- ZERO_TO_MANY("0..n"),
+ OPTIONAL_MULTIPLE("0..n"),
/**
- * Cardinality 1..n
+ * Mandatory, multiple reference: At least one service must be available for
+ * the reference to be satisified. All matching services are available
+ * through this reference.
*/
- ONE_TO_MANY("1..n");
+ MANDATORY_MULTIPLE("1..n");
private final String cardinalityString;
diff --git a/scrplugin-annotations/src/main/java/org/apache/felix/scrplugin/annotations/Service.java b/scrplugin-annotations/src/main/java/org/apache/felix/scrplugin/annotations/Service.java
index 226c64e..800871b 100644
--- a/scrplugin-annotations/src/main/java/org/apache/felix/scrplugin/annotations/Service.java
+++ b/scrplugin-annotations/src/main/java/org/apache/felix/scrplugin/annotations/Service.java
@@ -39,7 +39,7 @@
* property is not set provide elements will be generated for all interfaces
* generated by the class
*/
- Class value() default AutoDetect.class;
+ Class<?> value() default AutoDetect.class;
/**
* Whether the component is registered as a