Annotation Type Matches


Constrains a field value to ensure it matches the provided expression.

This constraint will always pass with an empty field. See Required to enforce a non-null value.

Since:
4.0.0
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    @Regex String
    Pattern to test string value against.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    Message to throw in an exception when a match fails.
    int
    Flags to pass to the compiled Pattern.
  • Element Details

    • value

      @Regex String value
      Pattern to test string value against.
      Returns:
      pattern to test against
      Since:
      4.0.0
    • flags

      int flags
      Flags to pass to the compiled Pattern.
      Returns:
      the regex pattern parsing flags
      Since:
      4.1.0
      See Also:
      Default:
      0
    • failureMessage

      Message to throw in an exception when a match fails.

      This message will be formatted as a MessageFormat with two parameters:

      1. the input string
      2. the pattern being matched
      Returns:
      message format.
      Since:
      4.0.0
      Default:
      ""