FELIX-2478 : Cardinality attribute for Property annotation should be of type string
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@965433 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/scrplugin/pom.xml b/scrplugin/pom.xml
index 7c79a4f..8b383a9 100644
--- a/scrplugin/pom.xml
+++ b/scrplugin/pom.xml
@@ -67,7 +67,7 @@
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.scr.annotations</artifactId>
- <version>1.3.0</version>
+ <version>1.3.1-SNAPSHOT</version>
</dependency>
<!-- Sling Servlet SCR Annotation -->
diff --git a/scrplugin/src/main/java/org/apache/felix/scrplugin/tags/annotation/defaulttag/PropertyTag.java b/scrplugin/src/main/java/org/apache/felix/scrplugin/tags/annotation/defaulttag/PropertyTag.java
index 33ca627..4900d9e 100644
--- a/scrplugin/src/main/java/org/apache/felix/scrplugin/tags/annotation/defaulttag/PropertyTag.java
+++ b/scrplugin/src/main/java/org/apache/felix/scrplugin/tags/annotation/defaulttag/PropertyTag.java
@@ -20,8 +20,7 @@
import java.util.*;
-import org.apache.felix.scr.annotations.Property;
-import org.apache.felix.scr.annotations.PropertyOption;
+import org.apache.felix.scr.annotations.*;
import org.apache.felix.scrplugin.Constants;
import org.apache.felix.scrplugin.tags.JavaClassDescription;
import org.apache.felix.scrplugin.tags.JavaField;
@@ -124,6 +123,10 @@
return Util.getShortValues(annotation, desc, "shortValue");
}
+ public PropertyUnbounded unbounded() {
+ return Util.getEnumValue(annotation, "unbounded", PropertyUnbounded.class, Property.class);
+ }
+
public Class<? extends java.lang.annotation.Annotation> annotationType() {
return null;
}
@@ -234,7 +237,15 @@
}
}
- if (this.annotation.cardinality() != 0) {
+ // cardinality handling
+ final PropertyUnbounded pu = this.annotation.unbounded();
+ if ( pu != PropertyUnbounded.DEFAULT ) {
+ if ( pu == PropertyUnbounded.ARRAY ) {
+ map.put(Constants.PROPERTY_CARDINALITY, "+");
+ } else {
+ map.put(Constants.PROPERTY_CARDINALITY, "-");
+ }
+ } else if (this.annotation.cardinality() != 0) {
map.put(Constants.PROPERTY_CARDINALITY, String.valueOf(this.annotation.cardinality()));
}