Package javax.validation.constraints
Annotation Interface Pattern
@Target({METHOD,FIELD,ANNOTATION_TYPE,CONSTRUCTOR,PARAMETER})
@Retention(RUNTIME)
@Documented
@Constraint(validatedBy={})
public @interface Pattern
The annotated
CharSequence
must match the specified regular expression.
The regular expression follows the Java regular expression conventions
see Pattern
.
Accepts CharSequence
. null
elements are considered valid.-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
Possible Regexp flags.static @interface
Defines severalPattern
annotations on the same element. -
Required Element Summary
-
Optional Element Summary
-
Element Details
-
regexp
String regexp- Returns:
- the regular expression to match
-
-
-
flags
Pattern.Flag[] flags- Returns:
- array of
Flag
s considered when resolving the regular expression
- Default:
- {}
-
message
String message- Returns:
- the error message template
- Default:
- "{javax.validation.constraints.Pattern.message}"
-
groups
Class<?>[] groups- Returns:
- the groups the constraint belongs to
- Default:
- {}
-
payload
- Returns:
- the payload associated to the constraint
- Default:
- {}
-