public interface Proc
extends org.hamcrest.SelfDescribing
ProcBase.
For quick implementations in anonymous classes, see P0, P1,
P2, P3, P4, and PN.
A proc is generally executed only once. The result or the exception
that was thrown are cached.
The only way to reset the state of a proc is with retry().
If a proc is called a new instance is
created that will execute the code of the original proc, but may use
different arguments.| Modifier and Type | Method and Description |
|---|---|
Proc0 |
asProc0() |
<A> Proc1<A> |
asProc1() |
<A,B> Proc2<A,B> |
asProc2() |
<A,B,C> Proc3<A,B,C> |
asProc3() |
<A,B,C,D> Proc4<A,B,C,D> |
asProc4() |
Proc |
call(Object... args)
Creates a new Proc that invokes the code of this Proc with
args. |
Proc |
callAgain()
Creates a new Proc that invokes the code of this Proc
and uses the same arguments.
|
Proc |
curry(Object... args) |
Proc |
curryAt(int i,
Object... args) |
Object[] |
getArgs()
The arguments that were used for the execution of this Proc.
|
Throwable |
getException()
Returns the exception that was thrown during execution,
or
null if the proc completed without error. |
Object |
getResult()
Returns the result of the execution,
or
null if an exception was thrown. |
boolean |
hasResult()
Returns true iff executing this Proc caused no exceptions.
|
Proc |
retry()
Resets the Proc.
|
Proc |
with(Object... args)
Alias for
call(java.lang.Object[]). |
Object[] getArgs()
Proc retry()
Proc callAgain()
Proc call(Object... args)
args.args - Proc with(Object... args)
call(java.lang.Object[]).call(java.lang.Object[])boolean hasResult()
getResult() can be called to retrieve the result of
the execution. Otherwise, getException() will return the
exception that was thrown.Object getResult()
null if an exception was thrown.Throwable getException()
null if the proc completed without error.Proc0 asProc0()
<A> Proc1<A> asProc1()
<A,B> Proc2<A,B> asProc2()
<A,B,C> Proc3<A,B,C> asProc3()
<A,B,C,D> Proc4<A,B,C,D> asProc4()
Copyright © 2013. All Rights Reserved.