zoukankan      html  css  js  c++  java
  • shop--8.商品类别--辅助工具

    ProductCategoryEnum

    public enum ProductCategoryEnum {
        SUCCESS(1, "创建成功"), INNER_ERROR(-1001, "操作失败"), EMPTY_LIST(-1002, "添加数少于1");
    
        private int state;
        private String stateInfo;
    
        private ProductCategoryEnum(int state, String stateInfo) {
            this.state = state;
            this.stateInfo = stateInfo;
        }
    
        public int getState() {
            return state;
        }
    
        public String getStateInfo() {
            return stateInfo;
        }
    
        /**
         * 依据传入的state返回相应的enum值
         */
        public static ProductCategoryEnum stateof(int state){
            for(ProductCategoryEnum s : values()){
                if(s.getState() == state){
                    return s;
                }
            }
            return null;
        }
    }
    

      

    ProductCategoryException

    public class ProductCategoryException extends RuntimeException{
        private static final long serialVersionUID = 3278462788156006845L;
    
        public ProductCategoryException(String message) {
            super( message );
        }
    }
    

      

    ProductCategoryExecution

    public class ProductCategoryExecution {
        private int state;
        private String stateInfo;
        private List<ProductCategory> productCategoryList;
    
        public ProductCategoryExecution() {
        }
    
        //操作失败时,使用的构造器
        public ProductCategoryExecution(ProductCategoryEnum stateEnum ){
            this.state = stateEnum.getState();
            this.stateInfo = stateEnum.getStateInfo();
        }
    
        //操作成功时,使用的构造器
        public ProductCategoryExecution(ProductCategoryEnum stateEnum, List<ProductCategory> productCategoryList){
            this.state = stateEnum.getState();
            this.stateInfo = stateEnum.getStateInfo();
            this.productCategoryList = productCategoryList;
        }
    
        public int getState() {
            return state;
        }
    
        public void setState(int state) {
            this.state = state;
        }
    
        public String getStateInfo() {
            return stateInfo;
        }
    
        public void setStateInfo(String stateInfo) {
            this.stateInfo = stateInfo;
        }
    
        public List<ProductCategory> getProductCategoryList() {
            return productCategoryList;
        }
    
        public void setProductCategoryList(List<ProductCategory> productCategoryList) {
            this.productCategoryList = productCategoryList;
        }
    }
    

      

  • 相关阅读:
    第二阶段冲刺--每日立会(6)
    第二阶段冲刺--每日立会(5)
    第十六周进度表
    第十五周进度表
    梦断代码阅读笔记之六
    梦断代码阅读笔记之五
    梦断代码阅读笔记之四
    梦断代码阅读笔记之三
    梦断代码阅读笔记之二
    梦断代码阅读笔记之一
  • 原文地址:https://www.cnblogs.com/SkyeAngel/p/8916377.html
Copyright © 2011-2022 走看看