This is an automated email from the ASF dual-hosted git repository. rombert pushed a commit to annotated tag org.apache.sling.models.api-1.2.0 in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-models-api.git
commit 3f55c8181fe5e3b8c280e6fdafb9ebf4c2ecb7f2 Author: Stefan Seifert <[email protected]> AuthorDate: Fri Jan 23 23:05:13 2015 +0000 SLING-4212 Sling Models: Allow multiple values from ValueMap in the resource-path injector (applied patch by santiago garcía pimentel with some modifications) git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/models/api@1654430 13f79535-47bb-0310-9956-ffa450edef68 --- src/main/java/org/apache/sling/models/annotations/Path.java | 5 +++-- .../sling/models/annotations/injectorspecific/ResourcePath.java | 7 ++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/apache/sling/models/annotations/Path.java b/src/main/java/org/apache/sling/models/annotations/Path.java index a849683..7dec5f5 100644 --- a/src/main/java/org/apache/sling/models/annotations/Path.java +++ b/src/main/java/org/apache/sling/models/annotations/Path.java @@ -24,7 +24,7 @@ import java.lang.annotation.Target; import javax.inject.Qualifier; /** - * Provide a path on an @Inject. Not necessarily tied to the Resource Path injector (thus no + * Provide path(s) on an @Inject. Not necessarily tied to the Resource Path injector (thus no * @Source annotation), may be reused for other injector types. */ @Target({ ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER }) @@ -32,6 +32,7 @@ import javax.inject.Qualifier; @Qualifier public @interface Path { - public String value(); + public String value() default ""; + public String[] paths() default {}; } diff --git a/src/main/java/org/apache/sling/models/annotations/injectorspecific/ResourcePath.java b/src/main/java/org/apache/sling/models/annotations/injectorspecific/ResourcePath.java index 7a8d96c..abc5d04 100644 --- a/src/main/java/org/apache/sling/models/annotations/injectorspecific/ResourcePath.java +++ b/src/main/java/org/apache/sling/models/annotations/injectorspecific/ResourcePath.java @@ -29,7 +29,7 @@ import org.apache.sling.models.spi.injectorspecific.InjectAnnotation; /** * Annotation to be used on either methods, fields or constructor parameters to let Sling Models inject a - * resource by path. The path may be either in the path attribute or in a value map property with the given name. + * resource by path(s). The path may be either in the path/paths attribute or in a value map property with the given name. */ @Target({ METHOD, FIELD, PARAMETER }) @Retention(RUNTIME) @@ -41,6 +41,11 @@ public @interface ResourcePath { * Specifies the path of the resource. If not provided, the path is derived from the property name. */ public String path() default ""; + + /** + * Specifies more than one path for the resource. If not provided, a single path is derived from the property name. + */ + public String[] paths() default {}; /** * Specifies the name of the property containing the resource path. If empty or not set, then the name -- To stop receiving notification emails like this one, please contact "[email protected]" <[email protected]>.
