public abstract class CatchAndRethrowClosure<E> extends java.lang.Object implements Closure<E>
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.ListstrList = // some list try { CollctionUtils.forAllDo(strList, writer); } catch (FunctorException ex) { Throwable originalError = ex.getCause(); // handle error }
Constructor and Description |
---|
CatchAndRethrowClosure() |
Modifier and Type | Method and Description |
---|---|
void |
execute(E input)
Execute this closure on the specified input object.
|
public void execute(E input)
execute
in interface Closure<E>
input
- the input to execute onFunctorException
- (runtime) if the closure execution resulted in a
checked exception."Copyright © 2010 - 2020 Adobe Systems Incorporated. All Rights Reserved"