Package com.aspectran.core.util
Class MultiException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- com.aspectran.core.util.MultiException
-
- All Implemented Interfaces:
java.io.Serializable
public class MultiException extends java.lang.Exception
Wraps multiple exceptions. Allows multiple exceptions to be thrown as a single exception.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description MultiException()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(java.lang.Throwable e)
java.lang.Throwable
getThrowable(int i)
java.util.List<java.lang.Throwable>
getThrowables()
void
ifExceptionThrow()
Throw a MultiException.void
ifExceptionThrowMulti()
Throw a MultiException.void
ifExceptionThrowRuntime()
Throw a Runtime exception.int
size()
java.lang.String
toString()
-
-
-
Method Detail
-
add
public void add(java.lang.Throwable e)
-
size
public int size()
-
getThrowables
public java.util.List<java.lang.Throwable> getThrowables()
-
getThrowable
public java.lang.Throwable getThrowable(int i)
-
ifExceptionThrow
public void ifExceptionThrow() throws java.lang.Exception
Throw a MultiException. If this multi exception is empty then no action is taken. If it contains a single exception that is thrown, otherwise the this multi exception is thrown.- Throws:
java.lang.Exception
- the Error or Exception if nested is 1, or the MultiException itself if nested is more than 1.
-
ifExceptionThrowRuntime
public void ifExceptionThrowRuntime() throws java.lang.Error
Throw a Runtime exception. If this multi exception is empty then no action is taken. If it contains a single error or runtime exception that is thrown, otherwise the this multi exception is thrown, wrapped in a runtime exception.- Throws:
java.lang.Error
- if this exception contains exactly 1Error
java.lang.RuntimeException
- if this exception contains 1Throwable
but it is not an error, or it contains more than 1Throwable
of any type
-
ifExceptionThrowMulti
public void ifExceptionThrowMulti() throws MultiException
Throw a MultiException. If this multi exception is empty then no action is taken. If it contains a any exceptions then this multi exception is thrown.- Throws:
MultiException
- the MultiException if there are nested exception
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Throwable
-
-