@Pattern (jakarta.validation.constraints)
The @jakarta.validation.constraints.Pattern annotation is recognized by Apache Causeway as a means to specify a regular expression constraint for properties and action parameters of type java.lang.String.
For example, here’s the annotation being used on an action parameter:
import jakarta.validation.constraints.Pattern;
public Customer updateName(
@Pattern(
regexp="[A-Z].+",
message="Must begin with a capital."
)
final String name) {
setName(name);
return this;
}
// ...
and here’s an example of its use on a property:
import jakarta.validation.constraints.Pattern;
@Pattern(
regexp="[A-Z].+",
message="Must begin with a capital."
)
@Getter @Setter
private String name;
...