Closure that catches any checked exception and re-throws it as a
FunctorException runtime exception. Example usage:
// Create a catch and re-throw closure via anonymous subclass
CatchAndRethrowClosure<String> writer = new ThrowingClosure() {
private java.io.Writer out = // some writer
protected void executeAndThrow(String input) throws IOException {
out.write(input); // throwing of IOException allowed
}
};
// use catch and re-throw closure
java.util.List<String> strList = // some list
try {
CollectionUtils.forAllDo(strList, writer);
} catch (FunctorException ex) {
Throwable originalError = ex.getCause();
// handle error
}
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | execute(final E
the input to execute on input)Implements org. |
| protected abstract void |
| CatchAndRethrowClosure | back to summary |
|---|---|
| public CatchAndRethrowClosure() | |
| execute | back to summary |
|---|---|
| public void execute(final E input) Implements org. Execute this closure on the specified input object.
| |
| executeAndThrow | back to summary |
|---|---|
| protected abstract void executeAndThrow(E input) throws Throwable Execute this closure on the specified input object.
| |