You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2017/11/07 09:54:25 UTC

[sling-org-apache-sling-models-api] 05/07: SLING-3696 - adding support for defining a default injection strategy of required or optional. Also adding a @Required annotation

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.0.2
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-models-api.git

commit 3e99fd3e20a4ff4ed6bf78b4858051a7eef4ee4b
Author: Justin Edelson <ju...@apache.org>
AuthorDate: Tue Jun 24 18:37:50 2014 +0000

    SLING-3696 - adding support for defining a default injection strategy of required or optional. Also adding a @Required annotation
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/models/api@1605150 13f79535-47bb-0310-9956-ffa450edef68
---
 .../{package-info.java => DefaultInjectionStrategy.java}         | 7 +++++--
 src/main/java/org/apache/sling/models/annotations/Model.java     | 2 ++
 .../sling/models/annotations/{Model.java => Required.java}       | 9 +++------
 .../java/org/apache/sling/models/annotations/package-info.java   | 2 +-
 4 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/src/main/java/org/apache/sling/models/annotations/package-info.java b/src/main/java/org/apache/sling/models/annotations/DefaultInjectionStrategy.java
similarity index 92%
copy from src/main/java/org/apache/sling/models/annotations/package-info.java
copy to src/main/java/org/apache/sling/models/annotations/DefaultInjectionStrategy.java
index 365e0b4..277d1f7 100644
--- a/src/main/java/org/apache/sling/models/annotations/package-info.java
+++ b/src/main/java/org/apache/sling/models/annotations/DefaultInjectionStrategy.java
@@ -14,7 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-@Version("1.0.0")
 package org.apache.sling.models.annotations;
 
-import aQute.bnd.annotation.Version;
\ No newline at end of file
+public enum DefaultInjectionStrategy {
+
+    REQUIRED, OPTIONAL
+
+}
diff --git a/src/main/java/org/apache/sling/models/annotations/Model.java b/src/main/java/org/apache/sling/models/annotations/Model.java
index 9f801ae..cfb121a 100644
--- a/src/main/java/org/apache/sling/models/annotations/Model.java
+++ b/src/main/java/org/apache/sling/models/annotations/Model.java
@@ -31,4 +31,6 @@ public @interface Model {
 
     public Class<?>[] adaptables();
 
+    public DefaultInjectionStrategy defaultInjectionStrategy() default DefaultInjectionStrategy.REQUIRED;
+
 }
diff --git a/src/main/java/org/apache/sling/models/annotations/Model.java b/src/main/java/org/apache/sling/models/annotations/Required.java
similarity index 88%
copy from src/main/java/org/apache/sling/models/annotations/Model.java
copy to src/main/java/org/apache/sling/models/annotations/Required.java
index 9f801ae..4bd87e7 100644
--- a/src/main/java/org/apache/sling/models/annotations/Model.java
+++ b/src/main/java/org/apache/sling/models/annotations/Required.java
@@ -22,13 +22,10 @@ import java.lang.annotation.RetentionPolicy;
 import java.lang.annotation.Target;
 
 /**
- * Mark a class as adaptable via YAMF.
- *
+ * Marker annotation for required injections.
  */
-@Target(ElementType.TYPE)
+@Target({ ElementType.FIELD, ElementType.METHOD })
 @Retention(RetentionPolicy.RUNTIME)
-public @interface Model {
-
-    public Class<?>[] adaptables();
+public @interface Required {
 
 }
diff --git a/src/main/java/org/apache/sling/models/annotations/package-info.java b/src/main/java/org/apache/sling/models/annotations/package-info.java
index 365e0b4..1413f05 100644
--- a/src/main/java/org/apache/sling/models/annotations/package-info.java
+++ b/src/main/java/org/apache/sling/models/annotations/package-info.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-@Version("1.0.0")
+@Version("1.1.0")
 package org.apache.sling.models.annotations;
 
 import aQute.bnd.annotation.Version;
\ No newline at end of file

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.