Package org.apache.sling.validation.spi
Interface ValidatorContext
@ProviderType
public interface ValidatorContext
Used as parameter for each call of
Validator.validate(Object, ValidatorContext, ValueMap)
Exposes additional information about the context in which the validation was called.-
Method Summary
Modifier and TypeMethodDescription@NotNull ResourceBundle
@NotNull String
@Nullable org.apache.sling.api.resource.Resource
int
Returns the severity to be issued for validation failures in this context.@NotNull org.apache.sling.api.resource.ValueMap
-
Method Details
-
getLocation
- Returns:
- the relative location of the property which should be checked by the validator. Refers to the 'data' parameter of
Validator.validate(Object, ValidatorContext, ValueMap)
-
getValueMap
@NotNull @NotNull org.apache.sling.api.resource.ValueMap getValueMap()- Returns:
- all properties of the validated resource/valuemap (only used for validations considering multiple properties), never
null
.
-
getResource
@Nullable @Nullable org.apache.sling.api.resource.Resource getResource()- Returns:
- the resource on which the validation was triggered.
null
in case the validation was triggered on aValueMap
(viaValidationService.validate(ValueMap, org.apache.sling.validation.model.ValidationModel)
).
-
getSeverity
int getSeverity()Returns the severity to be issued for validation failures in this context.- Returns:
- the severity of the validation failure.
-
getDefaultResourceBundle
- Returns:
- resource bundle which should be able to give out the error message of the
Validator
in English.
-