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

      

  • 相关阅读:
    Linux下查看文件和文件夹大小
    linux sort 命令详解
    Linux基础入门之网络属性配置
    Change SSH Welcome Banner on Ubuntu
    怎样修复grub开机引导(grub rescue)
    SSH内网穿透 Reverse SSH Tunneling
    安装 Zsh 及 Oh-my-zsh
    change grayscale to pseudo colouring using colormap in Matlab
    How to block a specific IP Address using UFW
    Linux下查看文件和文件夹大小
  • 原文地址:https://www.cnblogs.com/SkyeAngel/p/8916377.html
Copyright © 2011-2022 走看看