3
使用来自PlayFramework和数据绑定的验证,是否有可能通过(可能)装饰器来避免绑定某些字段?如何避免绑定一些字段?
例如,我有这样的模式:
class User extends Model {
@Required
@Email
public String email;
// I'd like to avoid setting this
public String password;
}
,并在我的模型:
Store store = new Store();
Binder.bindBean(params.getRootParamNode(), store, null);
validation.valid(store);
如果用户POST电子邮件地址和密码,密码也会被设置,但我不想要。
我该怎么做?