com.metamatrix.api.exception
Class MultipleRuntimeException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by java.lang.RuntimeException
              extended by com.metamatrix.api.exception.MultipleRuntimeException
All Implemented Interfaces:
java.io.Serializable

public class MultipleRuntimeException
extends java.lang.RuntimeException
implements java.io.Serializable

MultipleRuntimeException is intended for situations where multiple, unrelated Throwables need to be thrown as a single RuntimeException. This is useful, for example, when an Exception is thrown in both the try and finally portions of a try- finally block. The Throwables are maintained within a list to allow them to be ordered by level of importance, with the first Throwable having the highest importance.

Since:
2.1
See Also:
Serialized Form

Constructor Summary
MultipleRuntimeException()
          Constructs an instance of this class with no message, a zero error code, and no Throwables.
MultipleRuntimeException(java.util.List throwables)
          Constructs an instance of this class with no message, a zero error code, and the specified set of Throwables.
MultipleRuntimeException(java.lang.String message)
          Constructs an instance of this class with the specified message, a zero error code, and no Throwables.
MultipleRuntimeException(java.lang.String message, java.util.List throwables)
          Constructs an instance of this class with the specified message, a zero error code, and the specified set of Throwables.
MultipleRuntimeException(java.lang.String message, java.lang.String code)
          Constructs an instance of this class with the specified message, the specified error code, and no Throwables.
MultipleRuntimeException(java.lang.String message, java.lang.String code, java.util.List throwables)
          Constructs an instance of this class with the specified message, the specified error code, and the specified set of Throwables.
MultipleRuntimeException(java.lang.String message, java.lang.String code, java.lang.Throwable[] throwables)
          Constructs an instance of this class with the specified message, the specified error code, and the specified set of Throwables.
MultipleRuntimeException(java.lang.String message, java.lang.Throwable[] throwables)
          Constructs an instance of this class with the specified message, a zero error code, and the specified set of Throwables.
MultipleRuntimeException(java.lang.Throwable[] throwables)
          Constructs an instance of this class with no message, a zero error code, and the specified set of Throwables.
 
Method Summary
 void addThrowable(java.lang.Throwable throwable)
          Adds the specified Throwable to the list of Throwables that comprise this Exception.
 void addThrowable(java.lang.Throwable throwable, int index)
          Adds the specified Throwable to the list of Throwables that comprise this Exception at the specified index.
protected  void constructMultipleRuntimeException(java.lang.String code, java.util.List throwables)
          Constructs an instance of this class with the specified error code and the specified set of Throwables.
 java.lang.String getCode()
          Returns the error code associated with this Exception.
 java.util.List getThrowables()
          Returns the list of Throwables that comprise this Exception (Guaranteed not to be null).
 void setCode(java.lang.String code)
          Sets the error code associated with this Exception.
 void setThrowables(java.util.List throwables)
          Sets the list of Throwables that comprise this Exception.
 java.lang.String toString()
          Overridden to return the concatentation of the toString() results from each of the Throwables within this Exception.
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MultipleRuntimeException

public MultipleRuntimeException()
Constructs an instance of this class with no message, a zero error code, and no Throwables.

Since:
2.1

MultipleRuntimeException

public MultipleRuntimeException(java.lang.String message)
Constructs an instance of this class with the specified message, a zero error code, and no Throwables.

Parameters:
message - The message describing this Exception
Since:
2.1

MultipleRuntimeException

public MultipleRuntimeException(java.util.List throwables)
Constructs an instance of this class with no message, a zero error code, and the specified set of Throwables.

Parameters:
throwables - The list of Throwables that comprise this Exception
Since:
2.1

MultipleRuntimeException

public MultipleRuntimeException(java.lang.Throwable[] throwables)
Constructs an instance of this class with no message, a zero error code, and the specified set of Throwables.

Parameters:
throwables - The list of Throwables that comprise this Exception
Since:
2.1

MultipleRuntimeException

public MultipleRuntimeException(java.lang.String message,
                                java.lang.String code)
Constructs an instance of this class with the specified message, the specified error code, and no Throwables.

Parameters:
message - The message describing this Exception
code - The error code associated with this Exception
Since:
2.1

MultipleRuntimeException

public MultipleRuntimeException(java.lang.String message,
                                java.util.List throwables)
Constructs an instance of this class with the specified message, a zero error code, and the specified set of Throwables.

Parameters:
message - The message describing this Exception
throwables - The list of Throwables that comprise this Exception
Since:
2.1

MultipleRuntimeException

public MultipleRuntimeException(java.lang.String message,
                                java.lang.Throwable[] throwables)
Constructs an instance of this class with the specified message, a zero error code, and the specified set of Throwables.

Parameters:
message - The message describing this Exception
throwables - The list of Throwables that comprise this Exception
Since:
2.1

MultipleRuntimeException

public MultipleRuntimeException(java.lang.String message,
                                java.lang.String code,
                                java.lang.Throwable[] throwables)
Constructs an instance of this class with the specified message, the specified error code, and the specified set of Throwables.

Parameters:
message - The message describing this Exception
code - The error code associated with this Exception
throwables - The list of Throwables that comprise this Exception
Since:
2.1

MultipleRuntimeException

public MultipleRuntimeException(java.lang.String message,
                                java.lang.String code,
                                java.util.List throwables)
Constructs an instance of this class with the specified message, the specified error code, and the specified set of Throwables.

Parameters:
message - The message describing this Exception
code - The error code associated with this Exception
throwables - The list of Throwables that comprise this Exception
Since:
2.1
Method Detail

addThrowable

public void addThrowable(java.lang.Throwable throwable)
Adds the specified Throwable to the list of Throwables that comprise this Exception.

Parameters:
throwable - The Throwable
Since:
2.1

addThrowable

public void addThrowable(java.lang.Throwable throwable,
                         int index)
Adds the specified Throwable to the list of Throwables that comprise this Exception at the specified index.

Parameters:
throwable - The Throwable
index - The index within the list of Throwables at which the Throwable should be added
Since:
2.1

constructMultipleRuntimeException

protected void constructMultipleRuntimeException(java.lang.String code,
                                                 java.util.List throwables)
Constructs an instance of this class with the specified error code and the specified set of Throwables.

Parameters:
code - The error code associated with this Exception
throwables - The list of Throwables that comprise this Exception
Since:
2.1

getCode

public java.lang.String getCode()
Returns the error code associated with this Exception.

Returns:
The error code
Since:
2.1

getThrowables

public java.util.List getThrowables()
Returns the list of Throwables that comprise this Exception (Guaranteed not to be null).

Returns:
The list of Throwables
Since:
2.1

setCode

public void setCode(java.lang.String code)
Sets the error code associated with this Exception.

Parameters:
code - The error code associated with this Exception
Since:
2.1

setThrowables

public void setThrowables(java.util.List throwables)
Sets the list of Throwables that comprise this Exception.

Parameters:
throwables - The list of Throwables that comprise this Exception
Since:
2.1

toString

public java.lang.String toString()
Overridden to return the concatentation of the toString() results from each of the Throwables within this Exception.

Overrides:
toString in class java.lang.Throwable
Returns:
the string representation
Since:
2.1


Copyright © 2009. All Rights Reserved.