Interface ValidatorFactory

  • @ProviderType
    public interface ValidatorFactory
    Each Validator is created via the according factory. The factories should be registered via the ServiceLoader mechanism
    • Field Detail


        static final String ID_PREFIX_JACKRABBIT
        Reserved prefix for all validator ids integrated in this JAR. No custom validator ids must start with this prefix.
        See Also:
        Constant Field Values
    • Method Detail

      • createValidator

        @Nullable Validator createValidator​(@NotNull
                                            @NotNull ValidationContext context,
                                            @NotNull ValidatorSettings settings)
        Creates a new validator for the given context.
        context - the validation context
        settings - the validator settings
        a new validator instance (lifecycle bound to the package outlined in context) or null in case there is no validation relevant for the given context
      • shouldValidateSubpackages

        boolean shouldValidateSubpackages()
        Returns whether the validator should by default also called for subpackages.
        true in case the validation with this validator should also happen for subpackages (recursively), otherwise false
      • getId

        @NotNull String getId()
        Returns the validator ID. It should be unique i.e. not overlap between any two validators. To achieve that use the format <prefix>-<name> for every ID. Reserved prefixes are "jackrabbit" (used by all OOTB validators), "aem" and "sling". For custom validators use a company name as prefix. The name should not contain the string "validator". The id should only contain lower case characters.
        the id of the validator returned by createValidator(ValidationContext, ValidatorSettings)
      • getServiceRanking

        int getServiceRanking()
        The service ranking will influence the order in which the validators will be called. In general: The higher the ranking the earlier it will be executed.
        the service ranking