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

📄 servicelocatorexception.java

📁 OBPM是一个开源
💻 JAVA
字号:
package cn.myapps.util.servicelocator;

/**
 * This class implements an exception which can wrapped a lower-level exception.
 */
public class ServiceLocatorException extends Exception {
    private Exception exception;

    /**
     * Creates a new ServiceLocatorException wrapping another exception, and
     * with a detail message.
     * @param message The detail message.
     * @param exception The wrapped exception
     */
    public ServiceLocatorException(String message, Exception exception) {
        super(message);
        this.exception = exception;
        return;
    }

    /**
     * Creates a ServiceLocatorException with the specified detail message.
     * @param message The detail message.
     */
    public ServiceLocatorException(String message) {
        this(message, null);
        return;
    }

    /**
     * Creates a new ServiceLocatorException wrapping another exception, and
     * with no detail message. 
     * @param exception The wrapped exception.
     */
    public ServiceLocatorException(Exception exception) {
        this(null, exception);
        return;
    }

    /**
     * Gets the wrapped exception. 
     * @return The wrapped exception.
     */
    public Exception getException() {
        return exception;
    }

    /**
     * Retrieves (recursively) the root cause exception. 
     * @return The root cause exception.
     */
    public Exception getRootCause() {
        if (exception instanceof ServiceLocatorException) {
            return ((ServiceLocatorException) exception).getRootCause();
        }
        return exception == null ? this : exception;
    }

    /* (non-Javadoc)
     * @see java.lang.Object#toString()
     */
    public String toString() {
        if (exception instanceof ServiceLocatorException) {
            return ((ServiceLocatorException) exception).toString();
        }
        return exception == null ? super.toString() : exception.toString();
    }
}

⌨️ 快捷键说明

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