Class AbstractRangeValidator<V>

java.lang.Object
com.globalmentor.beans.BoundPropertyObject
Type Parameters:
V - The value type this validator supports.
All Implemented Interfaces:
com.globalmentor.beans.PropertyBindable, com.globalmentor.beans.PropertyConstrainable, RangeValidator<V>, Validator<V>
Direct Known Subclasses:
AbstractComparableRangeValidator

public abstract class AbstractRangeValidator<V> extends AbstractValidator<V> implements RangeValidator<V>
An abstract implementation of a validator restricted to a range. The step value is considered relative either to the minimum value, if available, the maximum value, if available, or zero, in that order or priority.
Author:
Garret Wilson
  • Constructor Details

    • AbstractRangeValidator

      public AbstractRangeValidator(V minimum, V maximum, V step, boolean valueRequired)
      Minimum, maximum, step, and value required constructor.
      Parameters:
      minimum - The minimum value, inclusive, or null if the range has no lower bound.
      maximum - The maximum value, inclusive, or null if the range has no upper bound.
      step - The step amount, or null if the range has no increment value specified.
      valueRequired - Whether the value must be non-null in order to be considered valid.
  • Method Details

    • getMinimum

      public V getMinimum()
      Specified by:
      getMinimum in interface RangeValidator<V>
      Returns:
      The minimum value, inclusive, or null if the range has no lower bound.
    • getMaximum

      public V getMaximum()
      Specified by:
      getMaximum in interface RangeValidator<V>
      Returns:
      The maximum value, inclusive, or null if the range has no upper bound.
    • getStep

      public V getStep()
      Specified by:
      getStep in interface RangeValidator<V>
      Returns:
      The step amount, or null if the range has no increment value specified.