(1) Russian technology or Dr. Simplify
public Customer save(Customer customer) {inject();
try {
check(customer);
Customer saved = customerService.save(customer);
return customerDao.detach(saved);
} catch (Exception e) {
Messages messages = handleException(e);
customer.setMessages(messages);
return customer;
}
}
(2) Mr/Mrs 2003
public Customer save(Customer customer) {
return new BoundaryTemplate
@Override
public Customer wrap(Customer customer) {
check(customer);
Customer saved = customerService.save(customer);
return customerDao.detach(saved);
}
}.executeOn(customer);
}
(3) Human minifier
@BoundaryWrapper
public Customer save(Customer customer) {
check(customer);
Customer saved = customerService.save(customer);
return customerDao.detach(saved);
}
I have a strong bias that might surprise you, but please give me your votes before I confess.