• java enum 枚举类


     图一代码:

    public enum LogMethodEnum {
      WEBCSCARDVALID("返回值"),
      WEBCSVERIFYPASSWORD("返回值"),
      WEBCSSAVEPASSWORD("返回值"),
      WEBCSSETPASSWORD("返回值"),
      WEBCSQUERYTOTALBALANCE("返回值"),
      WEBCSQUERYCARDDETAIL("返回值"),
      WEBCSQUERYCOMPINFOR("返回值"),
      WEBCSQUERYTOTALDETAIL("返回值"),
      WEBCSQUERYACARDINFOREX("返回值"),
      WEBCSQUERYACARDINFOR("返回值"),
      WEBCSQUERYCARDINFOR("返回值"),
      WEBCSQUERYCARDACCOUNT("返回值"),
      WEBCSQUERYCARDINFOR_NP("返回值"),
      WEBCSQUERYCARDNO("返回值"),
      WEBCSQUERYCDBYDATE("返回值"),
      WEBCSQUERYTDBYDATE("返回值"),
      WEBCSQUERYBUSIREPORT("返回值"),
      WEBCSQUERYDISTRIBUTE("返回值"),
      WEBCSDISTOTALBALANCE("返回值"),
      WEBCSLOSTCARD("返回值");

      private String text;

      public String getText() {
        return text;
      }

      public LogMethodEnum(String text) {
        this.text = text;
      }

      public static void main(String[] args) {
        String str="WebCSCardValid";
        String returnStr = LogMethodEnum.valueOf(WebCSCardValid).getText();
        System.out.println(returnStr);
      }

    }

     图二代码:

    public enum LogCodeAndDescEnum {
      SUCCESS("0000","描述"),
      UNLAWFL_NEWSPAPER("0001","描述"),
      MESSAGE_DOMAIN("0002","描述");

      private String code;
      private String desc;

      public String getDesc() {
        return desc;
      }

      public String getCode() {
        return code;
      }

      WebServiceLogStatusEnum(String code,String desc) {
        this.desc = desc;
        this.code = code;
      }

      public static String codeGetDesc(int value) { // 根据状态码转成描述
        if (String.valueOf(value).equals("0098")) {
        return SYSTEM_FAILURE.desc;
        }
        if (String.valueOf(value).equals("0099")) {
        return SYSTEM_FAILURE_OTHER.desc;
        }
        switch (value) {
        case 0000:
          return SUCCESS.desc;
        case 0001:
          return UNLAWFL_NEWSPAPER.desc;
        case 0002:
          return MESSAGE_DOMAIN.desc;
        default:
          return null;
        }
      }

    }

    文章来源:https://www.cnblogs.com/0c7x4/,转载请标明原著

  • 相关阅读:
    HTML5中的audio在手机端和 微信端的自动播放
    vue框架
    购物车原理
    angular前端框架
    -webkit-line-clamp超过两行就出现省略号
    jQuery事件委托
    淘宝橱窗
    选字游戏
    大众点评订单分库分表实践
    业界难题-“跨库分页”的四种方案
  • 原文地址:https://www.cnblogs.com/0c7x4/p/9146637.html
Copyright © 2020-2023  润新知