public class WhileClosure extends java.lang.Object implements Closure, java.io.Serializable
WARNING: from v3.2.2 onwards this class will throw an
UnsupportedOperationException
when trying to serialize or
de-serialize an instance to prevent potential remote code execution exploits.
In order to re-enable serialization support for WhileClosure
the following system property can be used (via -Dproperty=true):
org.apache.commons.collections.enableUnsafeSerialization
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 © 2010 - 2020 Adobe Systems Incorporated. All Rights Reserved"