Annotation Interface Range


@Retention(RUNTIME) @Target(FIELD) public @interface Range
Validates that a numeric field is within a range.
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    long
    The maximum value.
    long
    The minimum 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

    • min

      long min
      The minimum value.
      Returns:
      the minimum value
    • max

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

      String message
      The error message.
      Returns:
      the message
      Default:
      "Value must be between {min} and {max}"
    • 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 between {min} and {max}"