public class MyDomain {
String test;
@NotBlank
@Pattern(regexp = "[0-9]")
public String getTest() {
return this.test;
}
}
I've written a commons library with default validation: the test string should never be blank.
But in one application I want to explicit allow blanks here for this parameter.
Question: how can I make the @Pattern validation conditional, eg based on a application.properties value?