• 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;
        }
    }
    

      

  • 相关阅读:
    Django请求的生命周期图解及流程
    Django中请求的生命周期
    127.0.0.1和0.0.0.0和本机IP的区别
    Linux中errno的含义
    wireshark 过滤表达式
    GDB调试
    【LinuxShell】grep用法详解
    Linux下 tftp 服务器的安装与使用
    设备掐断重启
    GDB disassemble
  • 原文地址:https://www.cnblogs.com/SkyeAngel/p/8916377.html
Copyright © 2020-2023  润新知