Annotation Type EmailMustHaveSameDomain


@Documented @Constraint(validatedBy=EmailMustHaveSameDomainValidator.class) @Target({TYPE,ANNOTATION_TYPE}) @Retention(RUNTIME) public @interface EmailMustHaveSameDomain
The annotated bean must contain at least two properties:
  • a field to compare (option field1)
  • another field to compared (option field2)
  • add the error to field1 (option addErrorToField1, default true)
  • add the error to field2 (option addErrorToField2, default true)
the eMail entry of field1 must have the same domain as the eMail entry of field2.
Supported types are beans, null elements are considered valid.
Author:
Manfred Tremmel
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static @interface 
    Defines several EmailMustHaveSameDomain annotations on the same element.
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    field1 name to compare.
    field2 name to compare.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    boolean
    add error to field1 (default true).
    boolean
    add error to field2 (default true).
    Class<?>[]
    groups to use.
    localized message.
    Class<? extends jakarta.validation.Payload>[]
    payload whatever.
  • Element Details

    • field1

      String field1
      field1 name to compare.
      Returns:
      field/path contains first entry
    • field2

      String field2
      field2 name to compare.
      Returns:
      field/path contains second entry
    • message

      String message
      localized message.
      Returns:
      localized validation message
      Default:
      "{de.knightsoftnet.validators.shared.EmailMustHaveSameDomain.message}"
    • groups

      Class<?>[] groups
      groups to use.
      Returns:
      array of validation groups
      Default:
      {}
    • addErrorToField1

      boolean addErrorToField1
      add error to field1 (default true).
      Returns:
      true if error should be added to field1
      Default:
      true
    • addErrorToField2

      boolean addErrorToField2
      add error to field2 (default true).
      Returns:
      true if error should be added to field2
      Default:
      true
    • payload

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