|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
edu.rice.cs.plt.lambda.WrappedException
public class WrappedException
A wrapper for checked exceptions, allowing them to be thrown by lambda code (and in other situations in which an interface does not allow checked exceptions to be thrown).
Clients should check for the expected exception type with code like the following:
try { ... }
catch (WrappedException e) {
if (e.getCause() instanceof SomeCheckedException) { throw (SomeCheckedException) e.getCause(); }
else { throw e; }
}
Unfortunately, the Java language does not allow abstraction over exception types — a method cannot
be declared to throw a variable type — so a generic version of the above block of code
cannot be included as a method here.
| Constructor Summary | |
|---|---|
WrappedException(java.lang.Throwable cause)
|
|
| Method Summary |
|---|
| Methods inherited from class java.lang.Throwable |
|---|
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public WrappedException(java.lang.Throwable cause)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||