Annotation Interface DecimalMax


The annotated element must be a number whose value must be lower or equal to the specified maximum.

Supported types are:

  • BigDecimal
  • BigInteger
  • CharSequence
  • byte, short, int, long, and their respective wrappers
Note that double and float are not supported due to rounding errors (some providers might provide some approximative support).

null elements are considered valid.

Author:
Emmanuel Bernard
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static @interface 
    Defines several DecimalMax annotations on the same element.
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    The String representation of the max value according to the BigDecimal string representation.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    Class<?>[]
     
    boolean
    Specifies whether the specified maximum is inclusive or exclusive.
     
    Class<? extends Payload>[]
     
  • Element Details

    • value

      String value
      The String representation of the max value according to the BigDecimal string representation.
      Returns:
      value the element must be lower or equal to
    • message

      String message
      Default:
      "{jakarta.validation.constraints.DecimalMax.message}"
    • groups

      Class<?>[] groups
      Default:
      {}
    • payload

      Class<? extends Payload>[] payload
      Default:
      {}
    • inclusive

      boolean inclusive
      Specifies whether the specified maximum is inclusive or exclusive. By default, it is inclusive.
      Returns:
      true if the value must be lower or equal to the specified maximum, false if the value must be lower
      Since:
      1.1
      Default:
      true