|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.commons.collections15.functors.IfClosure<T>
public class IfClosure<T>
Closure implementation acts as an if statement calling one or other closure based on a predicate.
| Constructor Summary | |
|---|---|
IfClosure(Predicate<? super T> predicate,
Closure<? super T> trueClosure,
Closure<? super T> falseClosure)
Constructor that performs no validation. |
|
| Method Summary | ||
|---|---|---|
void |
execute(T input)
Executes the true or false closure accoring to the result of the predicate. |
|
Closure<? super T> |
getFalseClosure()
Gets the closure called when false. |
|
static
|
getInstance(Predicate<? super T> predicate,
Closure<? super T> trueClosure,
Closure<? super T> falseClosure)
Factory method that performs validation. |
|
Predicate<? super T> |
getPredicate()
Gets the predicate. |
|
Closure<? super T> |
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<? super T> predicate,
Closure<? super T> trueClosure,
Closure<? super T> 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 <T> Closure<T> getInstance(Predicate<? super T> predicate,
Closure<? super T> trueClosure,
Closure<? super T> falseClosure)
predicate - predicate to switch ontrueClosure - closure used if truefalseClosure - closure used if false
if closure
IllegalArgumentException - if any argument is nullpublic void execute(T input)
execute in interface Closure<T>input - the input objectpublic Predicate<? super T> getPredicate()
public Closure<? super T> getTrueClosure()
public Closure<? super T> getFalseClosure()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||