1/* Copyright (C) 2003 Vladimir Roubtsov. All rights reserved.
2 *
3 * This program and the accompanying materials are made available under
4 * the terms of the Common Public License v1.0 which accompanies this distribution,
5 * and is available at http://www.eclipse.org/legal/cpl-v10.html
6 *
7 * $Id: IThrowableWrapper.java,v 1.1.1.1 2004/05/09 16:57:58 vlad_r Exp $
8 */
9package com.vladium.util.exception;
10
11import java.io.PrintStream;
12import java.io.PrintWriter;
13
14// ----------------------------------------------------------------------------
15/**
16 * TODO: javadoc
17 *
18 * Any exception that wraps around another exception and wishes to be fully
19 * inspectable by {@link ExceptionCommon} should implement this interface.
20 * Note that JDK 1.4+ obsoletes the need for an explicit interface like this,
21 * although the implementation in {@link ExceptionCommon} is upwards compatible
22 * with it.
23 *
24 * @author Vlad Roubtsov, (C) 2002
25 */
26interface IThrowableWrapper
27{
28    // public: ................................................................
29
30    /**
31     * Gets the Throwable being wrapped. This method signature is the same as
32     * Throwable.getCause() in J2SE 1.4.
33     *
34     * @return Throwable being wrapped by this object [can be null].
35     */
36    Throwable getCause ();
37
38    /**
39     * Every exception hierarchy implementing this interface must ensure that
40     * this method delegates to super.printStackTrace(pw) where 'super' is the
41     * first superclass not implementing IThrowableWrapper. This is used by
42     * {@link ExceptionCommon} to avoid infinite
43     * recursion and is not meant to be called by other classes.
44     */
45    void __printStackTrace (PrintWriter pw);
46
47    /**
48     * Every exception hierarchy implementing this interface must ensure that
49     * this method delegates to super.printStackTrace(ps) where 'super' is the
50     * first superclass not implementing IThrowableWrapper. This is used by
51     * {@link ExceptionCommon} to avoid infinite
52     * recursion and is not meant to be called by other classes.
53     */
54    void __printStackTrace (PrintStream ps);
55
56} // end of interface
57// ----------------------------------------------------------------------------
58