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 ResourceintReturns the severity to be issued for validation failures in this context.@NotNull 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
- Returns:
- all properties of the validated resource/valuemap (only used for validations considering multiple properties), never
null.
-
getResource
- Returns:
- the resource on which the validation was triggered.
nullin 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
Validatorin English.
-