|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.commons.collections.functors.IfClosure
Closure implementation acts as an if statement calling one or other closure based on a predicate.
Constructor Summary | |
IfClosure(Predicate predicate,
Closure trueClosure,
Closure falseClosure)
Constructor that performs no validation. |
Method Summary | |
void |
execute(Object input)
Execute the correct closure. |
static Closure |
getInstance(Predicate predicate,
Closure trueClosure,
Closure falseClosure)
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 IfClosure(Predicate predicate, Closure trueClosure, Closure falseClosure)
getInstance
if you want that.
predicate
- predicate to switch on, not nulltrueClosure
- closure used if true, not nullfalseClosure
- closure used if false, not nullMethod Detail |
public static Closure getInstance(Predicate predicate, Closure trueClosure, Closure falseClosure)
predicate
- predicate to switch ontrueClosure
- closure used if truefalseClosure
- closure used if false
if
closure
IllegalArgumentException
- if any argument is nullpublic void execute(Object input)
execute
in interface Closure
input
- the input to execute on
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |