Package org.apache.struts.beanvalidation.constraints

# Annotation Interface FieldMatch

@Constraint(validatedBy=FieldMatchValidator.class) @Documented @Target({TYPE,ANNOTATION_TYPE}) @Retention(RUNTIME) public @interface FieldMatch
Validation annotation to validate that two fields are equal. An array of fields and their matching confirmation fields can be supplied.

Example, compare 1 pair of fields:

     @FieldMatch(first = "password", second = "confirmPassword", message = "The password fields must match")

Example, compare more than 1 pair of fields:

     @FieldMatch.List({
          @FieldMatch(first = "password", second = "confirmPassword", message = "The password fields must match"),
          @FieldMatch(first = "email", second = "confirmEmail", message = "The email fields must match")
     })

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static @interface`
  `FieldMatch.List`
  Defines several `@FieldMatch` annotations on the same element

- ## Required Element Summary

  Required Elements
  Modifier and Type
  Required Element
  Description
  `String`
  `first`
  `String`
  `second`

- ## Optional Element Summary

  Optional Elements
  Modifier and Type
  Optional Element
  Description
  `Class<?>[]`
  `groups`
  `String`
  `message`
  `Class<? extends jakarta.validation.Payload>[]`
  `payload`

- ## Element Details

  - ### first

    String first
    Returns:
      The first field

  - ### second

    String second
    Returns:
      The second field

- - ### message

    String message
    Default:
      "Fields are not matching"

  - ### groups

    Class<?>[] groups
    Default:
      {}

  - ### payload

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