Skip to content

Instantly share code, notes, and snippets.

@djalexd
Last active March 6, 2018 16:24
Show Gist options
  • Select an option

  • Save djalexd/5abb6815b17952e46d864e684e5e9cf2 to your computer and use it in GitHub Desktop.

Select an option

Save djalexd/5abb6815b17952e46d864e684e5e9cf2 to your computer and use it in GitHub Desktop.
class User {
@NotNull
String firstName;
}
void validate(User user) {
return javax.validation.Validation
.buildDefaultValidatorFactory()
.getValidator()
.validate(user);
}
/* if user.firstName is null, validation will fail with 'firstName' PropertyPath */
/* how can the PropertyPath be adjusted to 'first_name'? */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment