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.ALLoperator 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 SizeOperationValidatorgetInstance()Get the instanceprotected FilterOperatorgetOperator()This method is called by theapplymethod to determine whether to validate the query.protected voidvalidate(MappedField mappedField, java.lang.Object value, java.util.List<ValidationFailure> validationFailures)Performs the actual validation, and assumesappliesTohas 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:OperationValidatorThis method is called by theapplymethod 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:
getOperatorin 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:OperationValidatorPerforms the actual validation, and assumesappliesTohas returned true- Specified by:
validatein 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 newValidationFailuresto. If validation passed this list will not change.
-
-