SLING-4112 Sling Models: Optimize performance when read sling models annotations
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1639323 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/src/main/java/org/apache/sling/models/spi/injectorspecific/AbstractInjectAnnotationProcessor.java b/src/main/java/org/apache/sling/models/spi/injectorspecific/AbstractInjectAnnotationProcessor.java
index 9354463..692a53b 100644
--- a/src/main/java/org/apache/sling/models/spi/injectorspecific/AbstractInjectAnnotationProcessor.java
+++ b/src/main/java/org/apache/sling/models/spi/injectorspecific/AbstractInjectAnnotationProcessor.java
@@ -17,8 +17,7 @@
package org.apache.sling.models.spi.injectorspecific;
/**
- * Default implementation of ModelAnnotationProcessor.
- *
+ * Default implementation of {@link InjectAnnotationProcessor}.
*/
public class AbstractInjectAnnotationProcessor implements InjectAnnotationProcessor {
diff --git a/src/main/java/org/apache/sling/models/spi/injectorspecific/InjectAnnotationProcessorFactory.java b/src/main/java/org/apache/sling/models/spi/injectorspecific/InjectAnnotationProcessorFactory.java
index 326694e..831e593 100644
--- a/src/main/java/org/apache/sling/models/spi/injectorspecific/InjectAnnotationProcessorFactory.java
+++ b/src/main/java/org/apache/sling/models/spi/injectorspecific/InjectAnnotationProcessorFactory.java
@@ -18,7 +18,12 @@
import java.lang.reflect.AnnotatedElement;
+/**
+ * Factory for {@link InjectAnnotationProcessor} that is evaluated at runtime for each
+ * sling model adaption and may depend on the adaptable.
+ */
public interface InjectAnnotationProcessorFactory {
+
/**
*
* @param adaptable the object from which this model is adapted
@@ -28,4 +33,5 @@
* null
*/
InjectAnnotationProcessor createAnnotationProcessor(Object adaptable, AnnotatedElement element);
+
}
diff --git a/src/main/java/org/apache/sling/models/spi/injectorspecific/StaticInjectAnnotationProcessorFactory.java b/src/main/java/org/apache/sling/models/spi/injectorspecific/StaticInjectAnnotationProcessorFactory.java
new file mode 100644
index 0000000..a3eff7d
--- /dev/null
+++ b/src/main/java/org/apache/sling/models/spi/injectorspecific/StaticInjectAnnotationProcessorFactory.java
@@ -0,0 +1,37 @@
+/*
+ * 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.spi.injectorspecific;
+
+import java.lang.reflect.AnnotatedElement;
+
+/**
+ * Factory for {@link InjectAnnotationProcessor} that is evaluated once
+ * a sling model implementation class is registered.
+ * Whenever possible this interface should be favored above {@link InjectAnnotationProcessorFactory}.
+ */
+public interface StaticInjectAnnotationProcessorFactory {
+
+ /**
+ *
+ * @param element the field or method which is annotated
+ * @return a ModelAnnotationProcessor in case there is a known
+ * injector-specific annotation on the given element found otherwise
+ * null
+ */
+ InjectAnnotationProcessor createAnnotationProcessor(AnnotatedElement element);
+
+}
diff --git a/src/main/java/org/apache/sling/models/spi/injectorspecific/package-info.java b/src/main/java/org/apache/sling/models/spi/injectorspecific/package-info.java
index e9d341c..6c61a09 100644
--- a/src/main/java/org/apache/sling/models/spi/injectorspecific/package-info.java
+++ b/src/main/java/org/apache/sling/models/spi/injectorspecific/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.spi.injectorspecific;
import aQute.bnd.annotation.Version;
\ No newline at end of file