zoukankan      html  css  js  c++  java
  • shop--9.商品类别--批量操作--状态类、枚举类等

    ProductCategoryEnum

     1 public enum ProductCategoryStateEnum {
     2     SUCCESS(1, "创建成功"), INNER_ERROR(-1001, "操作失败"), EMPTY_LIST(-1002, "添加数少于1");
     3 
     4     private int state;
     5 
     6     private String stateInfo;
     7 
     8     private ProductCategoryStateEnum(int state, String stateInfo) {
     9         this.state = state;
    10         this.stateInfo = stateInfo;
    11     }
    12 
    13     public int getState() {
    14         return state;
    15     }
    16 
    17     public String getStateInfo() {
    18         return stateInfo;
    19     }
    20 
    21     public static ProductCategoryStateEnum stateOf(int index) {
    22         for (ProductCategoryStateEnum state : values()) {
    23             if (state.getState() == index) {
    24                 return state;
    25             }
    26         }
    27         return null;
    28     }
    29 
    30 }

    ProductCategoryExecution

     1 public class ProductCategoryExecution {
     2     // 结果状态
     3     private int state;
     4 
     5     // 状态标识
     6     private String stateInfo;
     7 
     8     // 操作的商铺类别
     9     private List<ProductCategory> productCategoryList;
    10 
    11     public ProductCategoryExecution() {
    12     }
    13 
    14     // 预约失败的构造器
    15     public ProductCategoryExecution(ProductCategoryStateEnum stateEnum) {
    16         this.state = stateEnum.getState();
    17         this.stateInfo = stateEnum.getStateInfo();
    18     }
    19 
    20     // 预约成功的构造器
    21     public ProductCategoryExecution(ProductCategoryStateEnum stateEnum,
    22             List<ProductCategory> productCategoryList) {
    23         this.state = stateEnum.getState();
    24         this.stateInfo = stateEnum.getStateInfo();
    25         this.productCategoryList = productCategoryList;
    26     }
    27 
    28     public int getState() {
    29         return state;
    30     }
    31 
    32     public void setState(int state) {
    33         this.state = state;
    34     }
    35 
    36     public String getStateInfo() {
    37         return stateInfo;
    38     }
    39 
    40     public void setStateInfo(String stateInfo) {
    41         this.stateInfo = stateInfo;
    42     }
    43 
    44     public List<ProductCategory> getProductCategoryList() {
    45         return productCategoryList;
    46     }
    47 
    48     public void setProductCategoryList(List<ProductCategory> productCategoryList) {
    49         this.productCategoryList = productCategoryList;
    50     }
    51 
    52 }

    ProductCategoryException

     1 public class ProductCategoryOperationException extends RuntimeException{
     2     
     3     /**
     4      * 
     5      */
     6     private static final long serialVersionUID = -3594075878279352727L;
     7 
     8     public ProductCategoryOperationException(String msg) {
     9         super(msg);
    10     }
    11 }
  • 相关阅读:
    MacOS升级到10.15.5,打开Flutter项目,或者运行‘flutter doctor’的时候,提示:“ 无法打开“dart”,因为Apple无法检查其是否包含恶意软件。 ”
    Expected a key while parsing a block mapping.
    iOS 与 Swift 方法互相调用
    iOS SDWebImage知识点
    什么是书?什么是看书?
    读《黑客与画家》
    System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt".
    读《瞬间之美》
    拆掉你思维里的墙
    将两个列不同的DataTable合并成一个新的DataTable
  • 原文地址:https://www.cnblogs.com/windbag7/p/9390877.html
Copyright © 2011-2022 走看看