Annotation Interface Pattern


@Documented @Constraint(validatedBy=PatternValidator.class) @Target({METHOD,FIELD,ANNOTATION_TYPE}) @Retention(RUNTIME) @ReportAsSingleViolation public @interface Pattern
Works like the standard @Pattern but applies to any type of object, converting to String as necessary via Object.toString(), and recursing on collection types.
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    Regular expression that must be matched.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    jakarta.validation.constraints.Pattern.Flag[]
    Regular expression flags.
    Class<?>[]
     
     
    Class<? extends jakarta.validation.Payload>[]
     
  • Element Details

    • regexp

      String regexp
      Regular expression that must be matched.
      Returns:
      regular expression
    • message

      String message
      Default:
      "Does not match the pattern \"{regexp}\""
    • groups

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

      Class<? extends jakarta.validation.Payload>[] payload
      Default:
      {}
    • flags

      jakarta.validation.constraints.Pattern.Flag[] flags
      Regular expression flags.
      Returns:
      regular expression flags
      Default:
      {}