I have a model with several constraint annotations. Is it possible to fill out the form with this model object, and then manually invoke the check. I am looking for something like this:
models.Photo photo = new models.Photo(); photo.loadValues(); Form<models.Photo> photoForm = new Form<models.Photo>(models.Photo.class); photoForm.fill(photo);
And then I could do something like this:
photoForm.validate(); #does not exist if (photoForm.hasErrors) { ... }
Update : estmatic Answer works very well. To convert an object to a map, I use Beanutils:
Map<String, String> photoMap = BeanUtils.describe(photo);
source share