Class 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)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • predicate

        private java.util.function.Predicate<java.lang.Integer> predicate
        A predicate for validating an integer value.
      • errorMessage

        private java.lang.String errorMessage
        An error message for when an integer value is invalid.
    • Constructor Detail

      • IntegerValueValidator

        public IntegerValueValidator​(int minValue,
                                     int maxValue)
      • IntegerValueValidator

        public IntegerValueValidator​(java.util.function.Predicate<java.lang.Integer> predicate,
                                     java.lang.String errorMessage)
    • Method Detail

      • validate

        public java.lang.Object validate​(java.lang.Object value)
        Specified by:
        validate in interface PropertyValidator