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
diff --git a/src/main/java/org/apache/sling/models/annotations/DefaultInjectionStrategy.java b/src/main/java/org/apache/sling/models/annotations/DefaultInjectionStrategy.java
new file mode 100644
index 0000000..277d1f7
--- /dev/null
+++ b/src/main/java/org/apache/sling/models/annotations/DefaultInjectionStrategy.java
@@ -0,0 +1,23 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sling.models.annotations;
+
+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 Class<?>[] adaptables();
 
+    public DefaultInjectionStrategy defaultInjectionStrategy() default DefaultInjectionStrategy.REQUIRED;
+
 }
diff --git a/src/main/java/org/apache/sling/models/annotations/Required.java b/src/main/java/org/apache/sling/models/annotations/Required.java
new file mode 100644
index 0000000..4bd87e7
--- /dev/null
+++ b/src/main/java/org/apache/sling/models/annotations/Required.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sling.models.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Marker annotation for required injections.
+ */
+@Target({ ElementType.FIELD, ElementType.METHOD })
+@Retention(RetentionPolicy.RUNTIME)
+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