Interface ValidatorFactory
-
@ProviderType public interface ValidatorFactoryEachValidatoris created via the according factory. The factories should be registered via theServiceLoadermechanism
-
-
Field Summary
Fields Modifier and Type Field Description static StringID_PREFIX_JACKRABBITReserved prefix for all validator ids integrated in this JAR.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description @Nullable ValidatorcreateValidator(@NotNull ValidationContext context, @NotNull ValidatorSettings settings)Creates a new validator for the given context.@NotNull StringgetId()Returns the validator ID.intgetServiceRanking()The service ranking will influence the order in which the validators will be called.booleanshouldValidateSubpackages()Returns whether the validator should by default also called for subpackages.
-
-
-
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 contextsettings- the validator settings- Returns:
- a new validator instance (lifecycle bound to the package outlined in context) or
nullin 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:
truein case the validation with this validator should also happen for subpackages (recursively), otherwisefalse
-
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
-
-