public class ForClosure<E> extends 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 and Description |
---|
ForClosure(int count,
Closure<? super E> closure)
Constructor that performs no validation.
|
Modifier and Type | Method and 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 ForClosure(int count, Closure<? super E> closure)
forClosure
if you want that.count
- the number of times to execute the closureclosure
- the closure to execute, not nullpublic 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 Closure<? super E> getClosure()
public int getCount()
Copyright © 2001–2019 The Apache Software Foundation. All rights reserved.