泛型

package com.mmall.common;

public enum ResponseCode {

    SUCCESS(0,"SUCESSS"),
    ERROR(1,"ERROR"),
    NEED_LOGIN(10,"NEWWD_LOGIN"),
    ILLEGAL_ARGUMENT(2,"ILLEGAL_AGRUMENT");

    private final int code;
    private final String desc;


    ResponseCode(int code,String desc){

        this.code = code;
        this.desc = desc;
    }

    public int getCode(){

        return code;
    }

    public String getDesc(){

        return desc;
    }



}

反编译命令是java -jar cfr_0_125.jar --sugarenums false ResponseCode.class
--sugarenums false参数作用是去除语法糖

/*
 * Decompiled with CFR 0_125.
 *
 * Could not load the following classes:
 *  java.lang.Enum
 *  java.lang.Object
 *  java.lang.String
 */
package com.mmall.common;

public final class ResponseCode
extends Enum<ResponseCode> {
    public static final /* enum */ ResponseCode SUCCESS = new ResponseCode(0, "SUCESSS");
    public static final /* enum */ ResponseCode ERROR = new ResponseCode(1, "ERROR");
    public static final /* enum */ ResponseCode NEED_LOGIN = new ResponseCode(10, "NEWWD_LOGIN");
    public static final /* enum */ ResponseCode ILLEGAL_ARGUMENT = new ResponseCode(2, "ILLEGAL_AGRUMENT");
    private final int code;
    private final String desc;
    private static final /* synthetic */ ResponseCode[] $VALUES;

    public static ResponseCode[] values() {
        return (ResponseCode[])$VALUES.clone();
    }

    public static ResponseCode valueOf(String string) {
        return (ResponseCode)Enum.valueOf(ResponseCode.class, (String)string);
    }

    private ResponseCode(int n2, String string2) {
        super(string, n);
        this.code = n2;
        this.desc = string2;
    }

    public int getCode() {
        return this.code;
    }

    public String getDesc() {
        return this.desc;
    }

    static {
        $VALUES = new ResponseCode[]{SUCCESS, ERROR, NEED_LOGIN, ILLEGAL_ARGUMENT};
    }
}
posted @ 2018-06-07 15:37  生活它不如诗  阅读(155)  评论(0编辑  收藏  举报