Created
May 26, 2017 17:02
-
-
Save naturalwarren/6be49c6033e97789311998b7ade8e8d3 to your computer and use it in GitHub Desktop.
An example model with RAVE validation.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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