Class AbstractValidatorRange<V,R extends Comparable<?>>

Type Parameters:
V - the generic type of the value to validate.
R - the generic type of the Range-bounds.
All Implemented Interfaces:
io.github.mmm.base.lang.Composable<Validator<?>>, Validator<V>, Iterable<Validator<?>>
Direct Known Subclasses:
AbstractValidatorSize, ValidatorRange

public abstract class AbstractValidatorRange<V,R extends Comparable<?>> extends AbstractValueValidator<V>
Validator validating that a given value is contained in a given Range.
Since:
1.0.0
  • Field Details

  • Constructor Details

    • AbstractValidatorRange

      public AbstractValidatorRange(io.github.mmm.base.range.Range<R> range)
      The constructor.
      Parameters:
      range - is the Range the value has to be contained in.
  • Method Details

    • getId

      public String getId()
      Specified by:
      getId in interface Validator<V>
      Overrides:
      getId in class AbstractValidator<V>
    • getRange

      public io.github.mmm.base.range.Range<R> getRange()
      Returns:
      the Range to validate.
    • getMin

      public R getMin()
    • getMax

      public R getMax()
    • convertValue

      protected R convertValue(V value)
      Converts the value to the type of the range.
      Parameters:
      value - is the value to convert.
      Returns:
      the converted value.
    • validateNotNull

      protected NlsMessage validateNotNull(V value)
      Specified by:
      validateNotNull in class AbstractValueValidator<V>
    • isLength

      protected abstract boolean isLength()
      Returns:
      true if validating the length or size of the value, false otherwise.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class AbstractValidator<V>
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class AbstractValidator<V>