public interface Closure
Closure
is a snippet of code that can access variables
from one context while running in another. Closure
s are
used with Expect4J to define handlers that are executed whenever a
corresponding Match
is found.
Currently in Java, all variables accessed by the Closure
need to be marked as final
. To export information from
the Closure
context to the context in which the
Closure
is defined, consider using buffers such as
final
.
StringBuffer
TODO: examples
Modifier and Type | Method and Description |
---|---|
void |
run(ExpectState state)
The main execution of the
Closure . |
void run(ExpectState state) throws Exception
Closure
. All care should
be taken to avoid throwing Exception
s, though the
calling context is responsible for catching any thrown.
Information about the triggering condition, such as the match or
submatch strings, can be obtained through the ExpectState
instance provided.state
- the contextual information on why this
Closure
was executedException
- in an extreme caseCopyright © 2015. All rights reserved.