Interface Validator<A extends Annotation,VIEWT>
- Type Parameters:
A- Type of the annotation that puts current validator to the field.VIEWT- Upper bound for field types that can be validated with this validator.
public interface Validator<A extends Annotation,VIEWT>
Interface for all configuration validators. Recommended to be a stateless class.
It is mandatory that all direct implementations of the interface explicitly specify types A and VIEW.
-
Method Summary
Modifier and TypeMethodDescriptiondefault booleancanValidate(Class<? extends Annotation> annotationType, Class<?> schemaFieldType, boolean namedList) Checks whether this validator can validate a schema field with given annotation and given class.voidvalidate(A annotation, ValidationContext<VIEWT> ctx) Perform validation.
-
Method Details
-
validate
Perform validation. All validation issues must be put intoValidationContext.addIssue(ValidationIssue).- Parameters:
annotation- Specific annotation from currently validated value.ctx- Validation context.
-
canValidate
default boolean canValidate(Class<? extends Annotation> annotationType, Class<?> schemaFieldType, boolean namedList) Checks whether this validator can validate a schema field with given annotation and given class.- Parameters:
annotationType- Annotation type, belonging to a field.schemaFieldType- Field type, according to configuration schema.namedList- Whether the validated value is a named list ofschemaFieldTypeelements or not.- Returns:
trueif this validator can be used to validate desired configuration property.
-