play.data.validation
Annotation Type Phone
@Retention(value=RUNTIME)
@Target(value={FIELD,PARAMETER})
@Constraint(checkWith=PhoneCheck.class)
public @interface Phone
This field contain a phone number
This validation is relaxed and is intended to enforce a basic phone pattern.
Please implement your own @Match for country specific
+CCC (SSSSSS)9999999999xEEEE
+ optional country code mark
CCC the optional country code, up to 3 digits
SSSSSS the optional sub-zone, up to 6 digits
9999999999 the actual number, up to 20 digits (which should cover all know cases current and future)
x an optional extension, which can also be spelled "ext" or "extension"
EEEE finally an optional extension
space, -, . and / are all considered delimiters and can be used anywhere in the number
i.e.
US: (305) 613 09 58 ext 101
France: +33 1 47 37 62 24 x3
Germany: +49-4312 / 777 777
China: +86 (10)69445464
UK: (020) 1234 1234
Message key: validation.phone
$1: field name
Optional Element Summary |
java.lang.String |
message
|
message
public abstract java.lang.String message
- Default:
- "validation.phone"
Guillaume Bort & zenexity - Distributed under Apache 2 licence, without any warrantly