Package org.apache.sling.models.spi
Interface ModelValidation
@ConsumerType
public interface ModelValidation
-
Method Summary
Modifier and TypeMethodDescription<ModelType>
RuntimeExceptionTriggers validation for the given model on the given adaptable
-
Method Details
-
validate
<ModelType> RuntimeException validate(Object adaptable, Class<ModelType> modelClass, boolean required) throws ValidationException, InvalidModelException Triggers validation for the given model on the given adaptable- Type Parameters:
ModelType
- Model type- Parameters:
adaptable
- the adaptable about to be used instantiate the Sling Model ClassmodelClass
- the class of the model which is about to be instantiatedrequired
- iftrue
validation fails even if validation model can't be found.- Returns:
null
if validation was successful, otherwise eitherValidationException
in case validation could not be performed for some reason (e.g. no validation information available) orInvalidModelException
in case the given model type could not be validated through theModelValidation
.- Throws:
ValidationException
InvalidModelException
-