Package dev.morphia.query.validation
Class SizeOperationValidator
- java.lang.Object
-
- dev.morphia.query.validation.OperationValidator
-
- dev.morphia.query.validation.SizeOperationValidator
-
- All Implemented Interfaces:
Validator
public final class SizeOperationValidator extends OperationValidator
Checks if the value can have theFilterOperator.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.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static SizeOperationValidator
getInstance()
Get the instanceprotected FilterOperator
getOperator()
This method is called by theapply
method to determine whether to validate the query.protected void
validate(MappedField mappedField, java.lang.Object value, java.util.List<ValidationFailure> validationFailures)
Performs the actual validation, and assumesappliesTo
has returned true-
Methods inherited from class dev.morphia.query.validation.OperationValidator
apply
-
-
-
-
Method Detail
-
getInstance
public static SizeOperationValidator getInstance()
Get the instance- Returns:
- the Singleton instance of this validator
-
getOperator
protected FilterOperator getOperator()
Description copied from class:OperationValidator
This method is called by theapply
method to determine whether to validate the query. The validator will only work for a single FilterOperator, and this will be returned by this method- Specified by:
getOperator
in classOperationValidator
- Returns:
- the FilterOperator this validator cares about.
-
validate
protected void validate(MappedField mappedField, java.lang.Object value, java.util.List<ValidationFailure> validationFailures)
Description copied from class:OperationValidator
Performs the actual validation, and assumesappliesTo
has returned true- Specified by:
validate
in classOperationValidator
- Parameters:
mappedField
- the field being queriedvalue
- the query value, to apply the operator to. This should not be null.validationFailures
- the list to add any newValidationFailures
to. If validation passed this list will not change.
-
-