Annotation Type PhoneNumberValue


@Documented @Constraint(validatedBy=PhoneNumberValueValidator.class) @Target({TYPE,ANNOTATION_TYPE}) @Retention(RUNTIME) public @interface PhoneNumberValue
The annotated element must be a valid phone number format.
Supported types are Strings, other Objects are transfered to Strings, null elements are considered valid. Different formats can be turned on/off with allowDin5008, allowE123, allowUri, allowMs and allowCommon. By default all formats are turned on, you can turn it off with false.
There are numeric, size and checksum tests by apache commons validation routines.
Author:
Manfred Tremmel
  • Nested Class Summary

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

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    boolean
    allow not standardized but common format (true/false).
    boolean
    allow din 5008 format (true/false).
    boolean
    allow E123 format (true/false).
    boolean
    are lower case country codes allowed (true/false).
    boolean
    allow microsoft format (true/false).
    boolean
    allow uri format (true/false).
    field name of the country code field.
    field name of the phone number field.
    Class<?>[]
    groups to use.
    localized message.
    Class<? extends jakarta.validation.Payload>[]
    payload whatever.
  • Element Details

    • message

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

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

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

      String fieldCountryCode
      field name of the country code field.
      Returns:
      field/path contains country code
      Default:
      "countryCode"
    • fieldPhoneNumber

      String fieldPhoneNumber
      field name of the phone number field.
      Returns:
      field/path contains phone number
      Default:
      "phoneNumber"
    • allowLowerCaseCountryCode

      boolean allowLowerCaseCountryCode
      are lower case country codes allowed (true/false).
      Returns:
      true if lower case country code is allowed
      Default:
      false
    • allowDin5008

      boolean allowDin5008
      allow din 5008 format (true/false).
      Returns:
      true if din 5008 format is allowed
      Default:
      true
    • allowE123

      boolean allowE123
      allow E123 format (true/false).
      Returns:
      true if E123 format is allowed
      Default:
      true
    • allowUri

      boolean allowUri
      allow uri format (true/false).
      Returns:
      true if uri format is allowed
      Default:
      true
    • allowMs

      boolean allowMs
      allow microsoft format (true/false).
      Returns:
      true if ms format is allowed
      Default:
      true
    • allowCommon

      boolean allowCommon
      allow not standardized but common format (true/false).
      Returns:
      true if common format is allowed
      Default:
      true