Class IntegerValueValidator
- java.lang.Object
-
- edu.caltech.nanodb.server.properties.IntegerValueValidator
-
- All Implemented Interfaces:
PropertyValidator
public class IntegerValueValidator extends java.lang.Object implements PropertyValidator
Validates an integer property value using a predicate; if the value cannot be cast to an integer or the predicate returns false, then the specified error message will be reported. The error message may use the"%d"
format-specifier to include the value passed to the validator.
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String
errorMessage
An error message for when an integer value is invalid.private java.util.function.Predicate<java.lang.Integer>
predicate
A predicate for validating an integer value.
-
Constructor Summary
Constructors Constructor Description IntegerValueValidator(int minValue, int maxValue)
IntegerValueValidator(java.util.function.Predicate<java.lang.Integer> predicate, java.lang.String errorMessage)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Object
validate(java.lang.Object value)
-
-
-
Method Detail
-
validate
public java.lang.Object validate(java.lang.Object value)
- Specified by:
validate
in interfacePropertyValidator
-
-