- package responsibilityPattern.handler;
- import responsibilityPattern.entity.Order;
- public class OrderStockHandler extends OrderHandler {
- @Override
- boolean proceed(Order order) throws Exception {
- //检查库存
- if(order.getStock()<1){
- throw new Exception("库存不足");
- }
- return true;
- }
- }
|