java中枚舉(enum)小例子。以前學過枚舉可是一直沒用,這裏有個枚舉類幫你我理解下(很膚淺)

直接上枚舉類,代碼簡單易懂。spa

package com.jy.modules.cims.data.interact.tbj.loan.request;

/**
 * 
 * @author shengzhoutao
 * 
 */
public enum RequestMethodORMEnum {
    /** 接收募集計劃申請 */
    METHOD_TBJ_LOAN_RAISE_PLAN {
        public String getRequestMethod() {
            return "tbj.loan.raise.plan";
        }

        public String getServiceMethod() {
            return "doAuditResult";
        }

        public Class<?> getServiceParameterClass() {
            return RequestRaisePlanDTO.class;
        }

        public String getServiceDesc() {
            return "接收募集計劃申請";
        }
    },

    /** 接收貸款審批結果 */
    METHOD_TBJ_LOAN_AUDIT_RESULT {
        public String getRequestMethod() {
            return "tbj.loan.audit.result";
        }

        public String getServiceMethod() {
            return "doAuditResult";
        }

        public Class<?> getServiceParameterClass() {
            return RequestAuditResultDTO.class;
        }

        public String getServiceDesc() {
            return "接收貸款審批結果";
        }
    },

    /** 接收貸款放款結果 */
    METHOD_TBJ_LOAN_LOAN_RESULT {
        public String getRequestMethod() {
            return "tbj.loan.loan.result";
        }

        public String getServiceMethod() {
            return "doLoanResult";
        }

        public Class<?> getServiceParameterClass() {
            return RequestLoanResultDTO.class;
        }

        public String getServiceDesc() {
            return "接收貸款放款結果";
        }
    },

    /** 接收產品相關的債權信息 */
    METHOD_TBJ_LOAN_PROD_LOAN {
        public String getRequestMethod() {
            return "tbj.loan.prod.loan";
        }

        public String getServiceMethod() {
            return "doProdLoan";
        }

        public Class<?> getServiceParameterClass() {
            return RequestProdLoanDTO.class;
        }

        public String getServiceDesc() {
            return "接收產品相關的債權信息";
        }
    },

    /** 接收債權匹配信息 */
    METHOD_TBJ_LOAN_TRADE_DEBTOR {
        public String getRequestMethod() {
            return "tbj.loan.trade.debtor";
        }

        public String getServiceMethod() {
            return "doTradeDebtor";
        }

        public Class<?> getServiceParameterClass() {
            return RequestTradeDebtorDTO.class;
        }

        public String getServiceDesc() {
            return null;
        }
    };

    // 獲取請求方法
    public abstract String getRequestMethod();

    // 獲取請求描述
    public abstract String getServiceDesc();

    // 獲取服務方法
    public abstract String getServiceMethod();

    // 獲取服務參數Class
    public abstract Class<?> getServiceParameterClass();

}

能夠直接調用code

 

 

RequestMethodORMEnum.METHOD_TBJ_LOAN_AUDIT_RESULT.getServiceDesc();blog

相關文章
相關標籤/搜索