public interface ModelFactory
| Modifier and Type | Method and Description |
|---|---|
boolean |
canCreateFromAdaptable(java.lang.Object adaptable,
java.lang.Class<?> type) |
<ModelType> |
createModel(java.lang.Object adaptable,
java.lang.Class<ModelType> type)
Instantiates the given Sling Model class from the given adaptable.
|
boolean |
isModelClass(java.lang.Class<?> type)
Checks if a given type can be instantiated though Sling Models.
|
boolean |
isModelClass(java.lang.Object adaptable,
java.lang.Class<?> type)
Deprecated.
Use
isModelClass(Class) instead! |
<ModelType> ModelType createModel(java.lang.Object adaptable,
java.lang.Class<ModelType> type)
throws MissingElementsException,
InvalidAdaptableException,
ModelClassException,
PostConstructException,
ValidationException,
InvalidModelException
adaptable - the adaptable to use to instantiate the Sling Model Classtype - the class to instantiatenull)MissingElementsException - in case no injector was able to inject some required values with the given typesInvalidAdaptableException - in case the given class cannot be instantiated from the given adaptable (different adaptable on the model annotation)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 calledPostConstructException - in case the post-construct method has thrown an exception itselfValidationException - in case validation could not be performed for some reason (e.g. no validation information available)InvalidModelException - in case the given model type could not be validated through the model validationboolean canCreateFromAdaptable(java.lang.Object adaptable,
java.lang.Class<?> type)
throws ModelClassException
adaptable - the adaptable to checktype - the class to checktrue in case the given class can be created from the given adaptableModelClassException - in case no class with the Model annotation adapts to the requested type@Deprecated
boolean isModelClass(java.lang.Object adaptable,
java.lang.Class<?> type)
isModelClass(Class) instead!adaptable - the adaptable to checktype - the class to checkModelboolean isModelClass(java.lang.Class<?> type)
Model which adapts to the given typetrue.type - the class to checktrue in case the given type can be instantiated though Sling Models."Copyright © 2010 - 2018 Adobe Systems Incorporated. All Rights Reserved"