Closure<E>
public class ForClosure<E> extends java.lang.Object implements Closure<E>
WARNING: from v4.1 onwards this class will not be serializable anymore in order to prevent potential remote code execution exploits. Please refer to COLLECTIONS-580 for more details.
Constructor | Description |
---|---|
ForClosure(int count,
Closure<? super E> closure) |
Constructor that performs no validation.
|
Modifier and Type | Method | Description |
---|---|---|
void |
execute(E input) |
Executes the closure
count times. |
static <E> Closure<E> |
forClosure(int count,
Closure<? super E> closure) |
Factory method that performs validation.
|
Closure<? super E> |
getClosure() |
Gets the closure.
|
int |
getCount() |
Gets the count.
|
public static <E> Closure<E> forClosure(int count, Closure<? super E> closure)
A null closure or zero count returns the NOPClosure
.
A count of one returns the specified closure.
E
- the type that the closure acts oncount
- the number of times to execute the closureclosure
- the closure to execute, not nullfor
closurepublic void execute(E input)
count
times.public Closure<? super E> getClosure()
public int getCount()
Copyright © 2001-2019 - Apache Software Foundation