public class ForClosure 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 ForClosure
the following system property can be used (via -Dproperty=true):
org.apache.commons.collections.enableUnsafeSerialization
Constructor and Description |
---|
ForClosure(int count,
Closure closure)
Constructor that performs no validation.
|
Modifier and Type | Method and Description |
---|---|
void |
execute(java.lang.Object input)
Executes the closure
count times. |
Closure |
getClosure()
Gets the closure.
|
int |
getCount()
Gets the count.
|
static Closure |
getInstance(int count,
Closure closure)
Factory method that performs validation.
|
public ForClosure(int count, Closure closure)
getInstance
if you want that.count
- the number of times to execute the closureclosure
- the closure to execute, not nullpublic static Closure getInstance(int count, Closure closure)
A null closure or zero count returns the NOPClosure
.
A count of one returns the specified closure.
count
- the number of times to execute the closureclosure
- the closure to execute, not nullfor
closurepublic void execute(java.lang.Object input)
count
times.public Closure getClosure()
public int getCount()
"Copyright © 2010 - 2020 Adobe Systems Incorporated. All Rights Reserved"