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 Details

    • getLocation

      @NotNull @NotNull String 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 ValueMap getValueMap()
      Returns:
      all properties of the validated resource/valuemap (only used for validations considering multiple properties), never null.
    • getResource

      @Nullable @Nullable Resource getResource()
      Returns:
      the resource on which the validation was triggered. null in case the validation was triggered on a ValueMap (via ValidationService.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

      @NotNull @NotNull ResourceBundle getDefaultResourceBundle()
      Returns:
      resource bundle which should be able to give out the error message of the Validator in English.