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

📄 baseappexception.java

📁 java下面的异常框架
💻 JAVA
字号:
package org.expframework.exceptions;

/**
 * A base class for all checked exceptions in the application.
 * 
 * @author ShriKant
 * 
 * @version 1.0
 */
public class BaseAppException extends Exception {

    static final long serialVersionUID = -5829545098534135052L;

    /**
     * the message of the BaseAppException.
     */
    private String exceptionMessage;

    /**
     * A public constructor for BaseAppException containing no arguments.
     *  
     */
    public BaseAppException() {
    }

    /**
     * A public constructor for BaseAppException specifying exception message.
     * <p>
     * 
     * @param msg
     *            exception message.
     *  
     */
    public BaseAppException(String msg) {
        this.exceptionMessage = msg;
    }

    /**
     * A public constructor of <code>BaseAppException</code> containing
     * message and root cause (as <code>Throwable</code>) of the exception.
     * 
     * @param msg
     *            exception message.
     * @param e
     *            Throwable object.
     *  
     */
    public BaseAppException(String msg, Throwable e) {
        this.exceptionMessage = msg;
        this.initCause(e);
    }

    /**
     * sets the root cause of the exception. Used for setting Java built in
     * exception in <code>BaseAppException</code>.
     * 
     * @param e
     *            Throwable object.
     *  
     */
    public void setCause(Throwable e) {
        this.initCause(e);
    }

    /*
     * Gets the class name and exception message.
     * 
     * @see java.lang.Object#toString()
     */
    public String toString() {
        String s = getClass().getName();
        return s + ": " + exceptionMessage;
    }

    /*
     * Gets the message of the exception. equivalent to Exception.getMessage().
     * 
     * @see java.lang.Throwable#getMessage()
     */
    public String getMessage() {
        return exceptionMessage;
    }
}

⌨️ 快捷键说明

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