Class NumericConstraints


  • public final class NumericConstraints
    extends java.lang.Object
    Common constraints for properties dealing with numbers.
    Since:
    6.10.0
    Author:
    Clément Fournier
    See Also:
    PropertyConstraint
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <N extends java.lang.Number & java.lang.Comparable<N>>
      PropertyConstraint<N>
      inRange​(N minInclusive, N maxInclusive)
      Requires the number to be inside a range.
      static <N extends java.lang.Number>
      PropertyConstraint<N>
      positive()
      Requires the number to be strictly positive.
      • Methods inherited from class java.lang.Object

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

      • inRange

        public static <N extends java.lang.Number & java.lang.Comparable<N>> PropertyConstraint<N> inRange​(N minInclusive,
                                                                                                           N maxInclusive)
        Requires the number to be inside a range.
        Type Parameters:
        N - Type of number
        Returns:
        A range constraint
      • positive

        public static <N extends java.lang.Number> PropertyConstraint<N> positive()
        Requires the number to be strictly positive. The int values of the number is used for comparison so there may be some unexpected behaviour with decimal numbers.
        Type Parameters:
        N - Type of number
        Returns:
        A positivity constraint