Class NumericConstraints


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

      • inRange

        public static <N extends Number & 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 NumberPropertyConstraint<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