public class WhileClosure extends java.lang.Object implements Closure, java.io.Serializable
Constructor and Description |
---|
WhileClosure(Predicate predicate,
Closure closure,
boolean doLoop)
Constructor that performs no validation.
|
Modifier and Type | Method and Description |
---|---|
void |
execute(java.lang.Object input)
Executes the closure until the predicate is false.
|
Closure |
getClosure()
Gets the closure.
|
static Closure |
getInstance(Predicate predicate,
Closure closure,
boolean doLoop)
Factory method that performs validation.
|
Predicate |
getPredicate()
Gets the predicate in use.
|
boolean |
isDoLoop()
Is the loop a do-while loop.
|
public WhileClosure(Predicate predicate, Closure closure, boolean doLoop)
getInstance
if you want that.predicate
- the predicate used to evaluate when the loop terminates, not nullclosure
- the closure the execute, not nulldoLoop
- true to act as a do-while loop, always executing the closure oncepublic static Closure getInstance(Predicate predicate, Closure closure, boolean doLoop)
predicate
- the predicate used to evaluate when the loop terminates, not nullclosure
- the closure the execute, not nulldoLoop
- true to act as a do-while loop, always executing the closure oncewhile
closurejava.lang.IllegalArgumentException
- if the predicate or closure is nullpublic void execute(java.lang.Object input)
public Predicate getPredicate()
public Closure getClosure()
public boolean isDoLoop()
Copyright © 2001-2012 Apache Software Foundation. All Rights Reserved.