public abstract class OperationValidator extends Object implements Validator
FilterOperator. Currently all
subclasses of this are final and singletons so this isn't the root of a massive class hierarchy.| Constructor and Description |
|---|
OperationValidator() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
apply(MappedField mappedField,
FilterOperator operator,
Object value,
List<ValidationFailure> validationFailures)
Apply validation for the given operator.
|
protected abstract FilterOperator |
getOperator()
This method is called by the
apply method to determine whether to validate the query. |
protected abstract void |
validate(MappedField mappedField,
Object value,
List<ValidationFailure> validationFailures)
Performs the actual validation, and assumes
appliesTo has returned true |
public boolean apply(MappedField mappedField, FilterOperator operator, Object value, List<ValidationFailure> validationFailures)
validationFailures.mappedField - the field being queriedoperator - any FilterOperator for a queryvalue - the query value, to apply the operator tovalidationFailures - the list to add any failures to. If validation passes or appliesTo returned false, this list will
not change.protected abstract FilterOperator getOperator()
apply method to determine whether to validate the query. The validator will only work for a
single FilterOperator, and this will be returned by this methodprotected abstract void validate(MappedField mappedField, Object value, List<ValidationFailure> validationFailures)
appliesTo has returned truemappedField - the field being queriedvalue - the query value, to apply the operator to. This should not be null.validationFailures - the list to add any new ValidationFailures to. If validation passed this list will not change.