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

commit 067c92a5c54e5d7e076c824877f65cc8f75c30c6
Author: Konrad Windszus <[email protected]>
AuthorDate: Thu Sep 10 08:36:33 2015 +0000

    SLING-4997 add new method isModelClass and deprecate the old one
    
    git-svn-id: 
https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/models/api@1702186
 13f79535-47bb-0310-9956-ffa450edef68
---
 .../apache/sling/models/factory/ModelFactory.java  | 24 ++++++++++++++++++----
 .../apache/sling/models/factory/package-info.java  |  2 +-
 2 files changed, 21 insertions(+), 5 deletions(-)

diff --git a/src/main/java/org/apache/sling/models/factory/ModelFactory.java 
b/src/main/java/org/apache/sling/models/factory/ModelFactory.java
index ec9e663..b7bc498 100644
--- a/src/main/java/org/apache/sling/models/factory/ModelFactory.java
+++ b/src/main/java/org/apache/sling/models/factory/ModelFactory.java
@@ -20,10 +20,12 @@ package org.apache.sling.models.factory;
 
 import javax.annotation.Nonnull;
 
+import org.apache.sling.models.annotations.Model;
+
 /**
- * The ModelFactory instantiates Sling Model classes similar to adaptTo but is 
allowed to throw an exception in case
+ * The ModelFactory instantiates Sling Model classes similar to {@link 
+#adaptTo} but will throw an exception in case
  * instantiation fails for some reason.
- *
  */
 public interface ModelFactory {
 
@@ -31,7 +33,7 @@ public interface ModelFactory {
      * Instantiates the given Sling Model class from the given adaptable.
      * @param adaptable the adaptable to use to instantiate the Sling Model 
Class
      * @param type the class to instantiate
-     * @return a new instance for the required model (never null)
+     * @return a new instance for the required model (never {@code null})
      * @throws MissingElementsException in case no injector was able to inject 
some required values with the given types
      * @throws InvalidAdaptableException in case the given class cannot be 
instantiated from the given adaptable (different adaptable on the model 
annotation)
      * @throws ModelClassException in case the model could not be instantiated 
because model annotation was missing, reflection failed, no valid constructor 
was found or post-construct could not be called
@@ -46,7 +48,7 @@ public interface ModelFactory {
      * 
      * @param adaptable the adaptable to check
      * @param type the class to check
-     * @return false in case the given class can not be created from the given 
adaptable
+     * @return {@code true} in case the given class can be created from the 
given adaptable
      * @throws ModelClassException in case no class with the Model annotation 
adapts to the requested type
      */
     public boolean canCreateFromAdaptable(@Nonnull Object adaptable, @Nonnull 
Class<?> type) throws ModelClassException;
@@ -58,7 +60,21 @@ public interface ModelFactory {
      * @return false in case no class with the Model annotation adapts to the 
requested type
      * 
      * @see org.apache.sling.models.annotations.Model
+     * @deprecated Use {@link #isModelClass(Class)} instead!
      */
+    @Deprecated
     public boolean isModelClass(@Nonnull Object adaptable, @Nonnull Class<?> 
type);
 
+    /**
+     * Checks if a given type can be instantiated though Sling Models. This 
checks that
+     * <ul>
+     * <li>there is a class annotated with {@link Model} which adapts to the 
given type</li>
+     * <li>this class is registered as Sling Model (i.e. the package is listed 
in the "Sling-Model-Packages" header from the bundles manifest)</li>
+     * Only if both conditions are fulfilled this method will return {@code 
true}.
+     * @param type the class to check
+     * @return {@code true} in case the given type can be instantiated though 
Sling Models. 
+     * 
+     */
+    public boolean isModelClass(@Nonnull Class<?> type);
+
 }
diff --git a/src/main/java/org/apache/sling/models/factory/package-info.java 
b/src/main/java/org/apache/sling/models/factory/package-info.java
index 334ad12..4a67bcc 100644
--- a/src/main/java/org/apache/sling/models/factory/package-info.java
+++ b/src/main/java/org/apache/sling/models/factory/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("2.0.0")
 package org.apache.sling.models.factory;
 
 import aQute.bnd.annotation.Version;
\ No newline at end of file

-- 
To stop receiving notification emails like this one, please contact
"[email protected]" <[email protected]>.

Reply via email to