Skip to content

Instantly share code, notes, and snippets.

@naturalwarren
Created May 26, 2017 17:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save naturalwarren/6be49c6033e97789311998b7ade8e8d3 to your computer and use it in GitHub Desktop.
Save naturalwarren/6be49c6033e97789311998b7ade8e8d3 to your computer and use it in GitHub Desktop.
An example model with RAVE validation.
@Validated(factory = RaveValidatorFactory.class)
public class MyModel {
@NonNull private String someString;
public MyModel(@NonNull String someString) {
this.someString = someString;
}
@NonNull
public String getSomeString() {
return someString;
}
@MustBeTrue
public boolean customValidationLogic() {
if (someString.contains("!")) {
return someString.charAt(someString.length() - 1) == '!';
}
return true;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment