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

      • ID_PREFIX_JACKRABBIT

        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
        @Nullable Validator createValidator​(@NotNull
                                            @NotNull ValidationContext context,
                                            @NotNull
                                            @NotNull ValidatorSettings settings)
        Creates a new validator for the given context.
        Parameters:
        context - the validation context
        settings - the validator settings
        Returns:
        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.
        Returns:
        true in case the validation with this validator should also happen for subpackages (recursively), otherwise false
      • getId

        @NotNull
        @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.
        Returns:
        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.
        Returns:
        the service ranking