org.apache.commons.collections.functors
public class IfClosure extends Object implements Closure, Serializable
Since: Commons Collections 3.0
Version: $Revision: 375766 $ $Date: 2006-02-07 23:10:36 +0000 (Tue, 07 Feb 2006) $
Constructor Summary | |
---|---|
IfClosure(Predicate predicate, Closure trueClosure)
Constructor that performs no validation.
| |
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)
Factory method that performs validation.
|
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.
|
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 trueClosure closure used if true, not null
Since: Commons Collections 3.2
getInstance
if you want that.
Parameters: predicate predicate to switch on, not null trueClosure closure used if true, not null falseClosure closure used if false, not null
Parameters: input the input object
Returns: the closure
Since: Commons Collections 3.1
This factory creates a closure that performs no action when the predicate is false.
Parameters: predicate predicate to switch on trueClosure closure used if true
Returns: the if
closure
Throws: IllegalArgumentException if either argument is null
Since: Commons Collections 3.2
Parameters: predicate predicate to switch on trueClosure closure used if true falseClosure closure used if false
Returns: the if
closure
Throws: IllegalArgumentException if any argument is null
Returns: the predicate
Since: Commons Collections 3.1
Returns: the closure
Since: Commons Collections 3.1