ModelAndView updateCustomer(HttpServletRequest req, HttpServletResponse res, Cusotmer c ){ // Cusotmer c = new Customer(); // bind(req, c);
}
2. 절차적 CusotmerMgmtBiz <- Customer {
javax.validation.Validator validator;
- Customer name must be not null - Customer age must be larger than 0 updateCustomer(Customer c){ assert c.name != null; assert c.age > 0;
// business logic }
3. 절차적 확장 // assert 확장 addCustomer(Customer c){ Validator.validate(c, "name", new MaxLength(15)); Validator.validate(c, "name", new MaxLength(15)); Validator.validate(c, "name", new MaxLength(15)); Validator.validate(c, "name", new MaxLength(15)); Validator.validate(c, "name", new MaxLength(15));
}
4. AOP registerCustomer(Customer c){ validator.validate(c); // business logic }
@RequiredValid unregisterCustomer(Customer c){ // business logic } }
AOP for @RequiredValid and Biz, Service { validator.validate(c); }