Package lv.id.jc.piglatin.core
Annotation Interface Word
@Documented
@Retention(RUNTIME)
@Constraint(validatedBy={})
@Target({PARAMETER,METHOD,FIELD})
@NotNull
@NotBlank
@Pattern(regexp="#\n# A single word\n# contains only Unicode letters and apostrophe (\') in the middle\n# only one apostrophe is allowed\n#\n^ # Start of the line\n( # Start of the group\n \\p{L} # Any Unicode letter\n| # OR\n (?<=\\p{L}) # Positive lookbehind for a Unicode letter\n \' # An apostrophe\n (?=\\p{L}) # Positive lookahead for a Unicode letter\n (?!.*\') # Negative lookahead for another apostrophe\n) # End of the group\n+ # One or more of the previous group\n$ # End of the line\n",
flags={COMMENTS,CASE_INSENSITIVE})
public @interface Word
A single word.
A single word contains only Unicode letters and apostrophe (') in the middle. Only one apostrophe is allowed.
Examples:
- word
- it's
- don't
- can't
- o'clock
-
Optional Element Summary
-
Element Details
-
message
String messageThe default error message if the validation fails.- Returns:
- the error message
- Default:
"must be a single word"
-
groups
Class<?>[] groupsThe groups the constraint belongs to.- Returns:
- the groups
- Default:
{}
-
payload
Class<? extends jakarta.validation.Payload>[] payloadThe payload that can be associated with a constraint violation.- Returns:
- the payload
- Default:
{}
-