Annotation Type PhoneNumber
@Documented
@Constraint(validatedBy=PhoneNumberValidator.class)
@Target({METHOD,FIELD,ANNOTATION_TYPE,CONSTRUCTOR,PARAMETER})
@Retention(RUNTIME)
public @interface PhoneNumber
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@PhoneNumberannotations 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).booleanallow microsoft format (true/false).booleanallow uri format (true/false).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:
- {}
-
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
-