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,
There are numeric, size and checksum tests by apache commons validation routines.
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 ClassesModifier and TypeClassDescriptionstatic @interfaceDefines several@PhoneNumberValueannotations on the same element. -
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionbooleanallow not standardized but common format (true/false).booleanallow din 5008 format (true/false).booleanallow E123 format (true/false).booleanare lower case country codes allowed (true/false).booleanallow microsoft format (true/false).booleanallow 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 messagelocalized message.- Returns:
- localized validation message
- Default:
- "{de.knightsoftnet.validators.shared.PhoneNumber.message}"
-
groups
Class<?>[] groupsgroups to use.- Returns:
- array of validation groups
- Default:
- {}
-
payload
Class<? extends jakarta.validation.Payload>[] payloadpayload whatever.- Returns:
- payload class
- Default:
- {}
-
fieldCountryCode
String fieldCountryCodefield name of the country code field.- Returns:
- field/path contains country code
- Default:
- "countryCode"
-
fieldPhoneNumber
String fieldPhoneNumberfield name of the phone number field.- Returns:
- field/path contains phone number
- Default:
- "phoneNumber"
-
allowLowerCaseCountryCode
boolean allowLowerCaseCountryCodeare lower case country codes allowed (true/false).- Returns:
- true if lower case country code is allowed
- Default:
- false
-
allowDin5008
boolean allowDin5008allow din 5008 format (true/false).- Returns:
- true if din 5008 format is allowed
- Default:
- true
-
allowE123
boolean allowE123allow E123 format (true/false).- Returns:
- true if E123 format is allowed
- Default:
- true
-
allowUri
boolean allowUriallow uri format (true/false).- Returns:
- true if uri format is allowed
- Default:
- true
-
allowMs
boolean allowMsallow microsoft format (true/false).- Returns:
- true if ms format is allowed
- Default:
- true
-
allowCommon
boolean allowCommonallow not standardized but common format (true/false).- Returns:
- true if common format is allowed
- Default:
- true
-