|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.commons.collections.functors.ForClosure
public class ForClosure
Closure implementation that calls another closure n times, like a for loop.
Constructor Summary | |
---|---|
ForClosure(int count,
Closure closure)
Constructor that performs no validation. |
Method Summary | |
---|---|
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
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 nullMethod Detail |
---|
public 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 null
for
closurepublic void execute(java.lang.Object input)
count
times.
execute
in interface Closure
input
- the input objectpublic Closure getClosure()
public int getCount()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |