|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.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)
Executes the true or false closure accoring to the result of the predicate. |
Closure |
getFalseClosure()
Gets the closure called when false. |
static Closure |
getInstance(Predicate predicate,
Closure trueClosure,
Closure falseClosure)
Factory method that performs validation. |
Predicate |
getPredicate()
Gets the predicate. |
Closure |
getTrueClosure()
Gets the closure called when true. |
| 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 null| Method 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 Closureinput - the input objectpublic Predicate getPredicate()
public Closure getTrueClosure()
public Closure getFalseClosure()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||