public final class SizeOperationValidator extends OperationValidator
FilterOperator.ALL operator applied to it. Since this class does not need state, and the
methods can't be static because it implements an interface, it seems to be one of the few places where the Singleton pattern seems
appropriate.| Modifier and Type | Method and Description |
|---|---|
static SizeOperationValidator |
getInstance()
Get the instance
|
protected FilterOperator |
getOperator()
This method is called by the
apply method to determine whether to validate the query. |
protected void |
validate(MappedField mappedField,
Object value,
List<ValidationFailure> validationFailures)
Performs the actual validation, and assumes
appliesTo has returned true |
applyprotected void validate(MappedField mappedField, Object value, List<ValidationFailure> validationFailures)
OperationValidatorappliesTo has returned truevalidate in class OperationValidatormappedField - 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.protected FilterOperator getOperator()
OperationValidatorapply method to determine whether to validate the query. The validator will only work for a
single FilterOperator, and this will be returned by this methodgetOperator in class OperationValidatorpublic static SizeOperationValidator getInstance()