@Retention(RUNTIME) @Target(FIELD) public @interface Max
Validates that a numeric field has a maximum value.
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    long
    The maximum value.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    The error message.
    The suggestion shown after the error message describing how to fix it.
  • Element Details

    • value

      long value
      The maximum value.
      Returns:
      the maximum value
    • message

      String message
      The error message.
      Returns:
      the message
      Default:
      "Value must be at most {value}"
    • suggestion

      String suggestion
      The suggestion shown after the error message describing how to fix it. Supports the same {...} placeholders as message() (substituted at validation time). Set to an empty string to omit the suggestion entirely.
      Returns:
      the suggestion template
      Default:
      "Use a value <= {value}"