Class RangeValidator

  • All Implemented Interfaces:
    Validator

    public class RangeValidator
    extends java.lang.Object
    implements Validator
    Validator that validates a configuration value is in a numeric range.
    • Constructor Summary

      Constructors 
      Constructor Description
      RangeValidator​(java.lang.Number min, java.lang.Number max)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static RangeValidator atLeast​(java.lang.Number min)
      A numeric range that checks the lower bound.
      static RangeValidator atMost​(java.lang.Number max)
      A numeric range that checks the upper bound.
      static RangeValidator between​(java.lang.Number min, java.lang.Number max)
      A numeric range that checks both lower and upper bounds.
      protected boolean canEqual​(java.lang.Object other)  
      java.lang.String documentation()
      Return the documentation for a given validator.
      boolean equals​(java.lang.Object o)  
      java.lang.Number getMax()  
      java.lang.Number getMin()  
      int hashCode()  
      java.lang.String toString()  
      boolean validate​(java.lang.String name, java.lang.Object value)
      Validates the configuration value.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • RangeValidator

        public RangeValidator​(java.lang.Number min,
                              java.lang.Number max)
    • Method Detail

      • atLeast

        public static RangeValidator atLeast​(java.lang.Number min)
        A numeric range that checks the lower bound.
        Parameters:
        min - the minimum acceptable value
        Returns:
        a numeric range that checks the lower bound
      • atMost

        public static RangeValidator atMost​(java.lang.Number max)
        A numeric range that checks the upper bound.
        Parameters:
        max - the maximum acceptable value
        Returns:
        a numeric range that checks the upper bound
      • between

        public static RangeValidator between​(java.lang.Number min,
                                             java.lang.Number max)
        A numeric range that checks both lower and upper bounds.
        Parameters:
        min - the minimum acceptable value
        max - the maximum acceptable value
        Returns:
        a numeric range that checks both lower and upper bounds
      • validate

        public boolean validate​(java.lang.String name,
                                java.lang.Object value)
        Description copied from interface: Validator
        Validates the configuration value.
        Specified by:
        validate in interface Validator
        Parameters:
        name - name of the configuration setting
        value - value of the configuration setting
        Returns:
        true if it is a valid value, otherwise false.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • documentation

        public java.lang.String documentation()
        Description copied from interface: Validator
        Return the documentation for a given validator.
        Specified by:
        documentation in interface Validator
        Returns:
        the documentation for a given validator
      • getMin

        public java.lang.Number getMin()
      • getMax

        public java.lang.Number getMax()
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • canEqual

        protected boolean canEqual​(java.lang.Object other)
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object