| java.lang.Object org.apache.commons.collections.functors.IfClosure
IfClosure | public class IfClosure implements Closure,Serializable(Code) | | Closure implementation acts as an if statement calling one or other closure
based on a predicate.
since: Commons Collections 3.0 version: $Revision: 375766 $ $Date: 2006-02-07 23:10:36 +0000 (Tue, 07 Feb 2006) $ author: Stephen Colebourne author: Matt Benson |
IfClosure | public IfClosure(Predicate predicate, Closure trueClosure)(Code) | | Constructor that performs no validation.
Use getInstance if you want that.
This constructor creates a closure that performs no action when
the predicate is false.
Parameters: predicate - predicate to switch on, not null Parameters: trueClosure - closure used if true, not null since: Commons Collections 3.2 |
IfClosure | public IfClosure(Predicate predicate, Closure trueClosure, Closure falseClosure)(Code) | | Constructor that performs no validation.
Use getInstance if you want that.
Parameters: predicate - predicate to switch on, not null Parameters: trueClosure - closure used if true, not null Parameters: falseClosure - closure used if false, not null |
execute | public void execute(Object input)(Code) | | Executes the true or false closure accoring to the result of the predicate.
Parameters: input - the input object |
getFalseClosure | public Closure getFalseClosure()(Code) | | Gets the closure called when false.
the closure since: Commons Collections 3.1 |
getInstance | public static Closure getInstance(Predicate predicate, Closure trueClosure)(Code) | | Factory method that performs validation.
This factory creates a closure that performs no action when
the predicate is false.
Parameters: predicate - predicate to switch on Parameters: trueClosure - closure used if true the if closure throws: IllegalArgumentException - if either argument is null since: Commons Collections 3.2 |
getInstance | public static Closure getInstance(Predicate predicate, Closure trueClosure, Closure falseClosure)(Code) | | Factory method that performs validation.
Parameters: predicate - predicate to switch on Parameters: trueClosure - closure used if true Parameters: falseClosure - closure used if false the if closure throws: IllegalArgumentException - if any argument is null |
getPredicate | public Predicate getPredicate()(Code) | | Gets the predicate.
the predicate since: Commons Collections 3.1 |
getTrueClosure | public Closure getTrueClosure()(Code) | | Gets the closure called when true.
the closure since: Commons Collections 3.1 |
|
|