⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sysexception.java

📁 javaEE 原代码 javaEE 原代码
💻 JAVA
字号:
package com;
import java.io.Serializable;


/**
 * iSCM系统异常类
 * @author
 * @version 2.0
 * @since 2.0
 */
public class SysException extends Exception implements Serializable {
    /**
     * @since 2.0
     */
    public static String LEVEL_SYS = "SYS";
    public static String LEVEL_APP = "APP";
    private String code = ""; //编码
    private String level = ""; //级别
    private String message = ""; //信息
    private String location = ""; //位置
    private Throwable hibException;
    private Throwable causeException;
    private String assistMsg = ""; //辅助信息说明

    public SysException() {
        super();
    }

    public SysException(String newCode) {
        if (newCode != null) {
            code = newCode;
        }

        level = "";
        message = "";
        location = "";
    }

    public SysException(String newCode, String newLevel) {
        if (newCode != null) {
            code = newCode;
        }

        if (newLevel != null) {
            level = newLevel;
        }

        message = "";
        location = "";
    }

    public SysException(String newCode, String newLevel, String newMessage) {
        if (newCode != null) {
            code = newCode;
        }

        if (newLevel != null) {
            level = newLevel;
        }

        if (newMessage != null) {
            message = newMessage;
        }

        location = "";
    }

    public SysException(String newCode, String newLevel, String newMessage,
        String newLocation) {
        if (newCode != null) {
            code = newCode;
        }

        if (newLevel != null) {
            level = newLevel;
        }

        if (newMessage != null) {
            message = newMessage;
        }

        if (newLocation != null) {
            location = newLocation;
        }
    }

    public SysException(String newCode, String newLevel, String newMessage,
        String newLocation, Throwable hib, Throwable cause,String newAssistMsg) {
        if (newCode != null) {
            code = newCode;
        }

        if (newLevel != null) {
            level = newLevel;
        }

        if (newMessage != null) {
            message = newMessage;
        }

        if (newLocation != null) {
            location = newLocation;
        }

        if (hib != null) {
            hibException = hib;
        }

        if (cause != null) {
            causeException = cause;
        }
        if(newAssistMsg!=null){
           assistMsg = newAssistMsg;
        }
    }
    public SysException(String newCode, String newLevel, String newMessage,
        String newLocation, Throwable hib, Throwable cause) {
        if (newCode != null) {
            code = newCode;
        }

        if (newLevel != null) {
            level = newLevel;
        }

        if (newMessage != null) {
            message = newMessage;
        }

        if (newLocation != null) {
            location = newLocation;
        }

        if (hib != null) {
            hibException = hib;
        }

        if (cause != null) {
            causeException = cause;
        }
    }

    public String toString() {
        StringBuffer ret = new StringBuffer();
        ret.append("SysException@code(");
        ret.append(code);
        ret.append(")type(");
        ret.append(assistMsg);
        ret.append(")level(");
        ret.append(level);
        ret.append(")message(");
        ret.append(message);
        ret.append(")location(");
        ret.append(location);
        ret.append(")ExcMsg(");

        if (hibException != null) {
            ret.append(hibException.getMessage());
        }

        ret.append(")causeExcMsg(");

        if (causeException != null) {
            ret.append(causeException.getMessage());
        }

        ret.append(")");

        return ret.toString();
    }

    public String getCode() {
        return code;
    }

    public void setCode(String temp) {
        if (temp != null) {
            code = temp;
        }
    }

    public String getLevel() {
        return level;
    }

    public void setLevel(String temp) {
        if (temp != null) {
            level = temp;
        }
    }

    public void setMessage(String temp) {
        if (temp != null) {
            message = temp;
        }
    }

    public String getMessage() {
        return message;
    }

    public void setLocation(String temp) {
        if (temp != null) {
            location = temp;
        }
    }

    public String getLocation() {
        return location;
    }

    public void setHibException(Throwable hib) {
        hibException = hib;
    }

    public Throwable getHibException() {
        return hibException;
    }

    public void setCauseException(Throwable cause) {
        causeException = cause;
    }

    public Throwable getCauseException() {
        return causeException;
    }

    public String getAssistMsg() {
        return assistMsg;
    }

    public void setAssistMsg(String newAssistMsg) {
        assistMsg = newAssistMsg;
    }
 }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -