Class RangeValidator

java.lang.Object
org.apache.bookkeeper.common.conf.validators.RangeValidator
All Implemented Interfaces:
Validator

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

    • RangeValidator

      public RangeValidator(Number min, Number max)
  • Method Details

    • atLeast

      public static RangeValidator atLeast(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(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(Number min, 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(String name, 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 String toString()
      Overrides:
      toString in class Object
    • documentation

      public 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 Number getMin()
    • getMax

      public Number getMax()
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • canEqual

      protected boolean canEqual(Object other)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object