org.apache.commons.collections.functors
Class ForClosure
java.lang.Object
org.apache.commons.collections.functors.ForClosure
- Closure, Serializable
public class ForClosure
extends java.lang.Object
Closure implementation that calls another closure n times, like a for loop.
$Revision: 348444 $ $Date: 2005-11-23 14:06:56 +0000 (Wed, 23 Nov 2005) $
ForClosure
public ForClosure(int count,
Closure closure)
Constructor that performs no validation.
Use getInstance
if you want that.
count
- the number of times to execute the closureclosure
- the closure to execute, not null
execute
public void execute(Object input)
Executes the closure count
times.
- execute in interface Closure
getClosure
public Closure getClosure()
Gets the closure.
getCount
public int getCount()
Gets the count.
getInstance
public static Closure getInstance(int count,
Closure closure)
Factory method that performs validation.
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
Copyright © 2001-2008 Apache Software Foundation. All Rights Reserved.