I want to check a domain object without automatically binding parameters to limit the properties that can be set by the client.
The next class (example from Play! Docs ) ...
public class User { @Required public String name; @Required @Min(0) public Integer age; }
... usually checked as
public static void hello(@Valid User user) { if(validation.hasErrors()) { params.flash(); validation.keep(); index(); } render(user); }
But in this case, all user
fields can be set by the client.
Is it possible to initiate verification of a domain object (rather than a "controller check") in Play! 1.2 explicitly?
public static void hello(long id, String name) { User user = User.findById(id); user.name = name; user.validate();
source share