Class IfClosure
java.lang.Object
org.apache.commons.collections.functors.IfClosure
- All Implemented Interfaces:
Serializable,Closure
@Deprecated(since="2021-04-30")
public class IfClosure
extends Object
implements Closure, Serializable
Deprecated.
Apache Commons Collections version 3.x is being deprecated from AEMaaCS. The upgraded version 4.4 of Commons Collections is already included as replacement. Customers are advised to upgrade to this version of the library. Please note: the package name was changed to org.apache.commons.collections4. Further note that there are AEM APIs currently exposing the old collections classes; these will be updated in upcoming releases.
Closure implementation acts as an if statement calling one or other closure
based on a predicate.
- Since:
- Commons Collections 3.0
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidDeprecated.Executes the true or false closure accoring to the result of the predicate.Deprecated.Gets the closure called when false.static ClosuregetInstance(Predicate predicate, Closure trueClosure) Deprecated.Factory method that performs validation.static ClosuregetInstance(Predicate predicate, Closure trueClosure, Closure falseClosure) Deprecated.Factory method that performs validation.Deprecated.Gets the predicate.Deprecated.Gets the closure called when true.
-
Constructor Details
-
IfClosure
Deprecated.Constructor that performs no validation. UsegetInstanceif you want that.This constructor creates a closure that performs no action when the predicate is false.
- Parameters:
predicate- predicate to switch on, not nulltrueClosure- closure used if true, not null- Since:
- Commons Collections 3.2
-
IfClosure
Deprecated.Constructor that performs no validation. UsegetInstanceif you want that.- Parameters:
predicate- predicate to switch on, not nulltrueClosure- closure used if true, not nullfalseClosure- closure used if false, not null
-
-
Method Details
-
getInstance
Deprecated.Factory method that performs validation.This factory creates a closure that performs no action when the predicate is false.
- Parameters:
predicate- predicate to switch ontrueClosure- closure used if true- Returns:
- the
ifclosure - Throws:
IllegalArgumentException- if either argument is null- Since:
- Commons Collections 3.2
-
getInstance
Deprecated.Factory method that performs validation.- Parameters:
predicate- predicate to switch ontrueClosure- closure used if truefalseClosure- closure used if false- Returns:
- the
ifclosure - Throws:
IllegalArgumentException- if any argument is null
-
execute
Deprecated.Executes the true or false closure accoring to the result of the predicate. -
getPredicate
Deprecated.Gets the predicate.- Returns:
- the predicate
- Since:
- Commons Collections 3.1
-
getTrueClosure
Deprecated.Gets the closure called when true.- Returns:
- the closure
- Since:
- Commons Collections 3.1
-
getFalseClosure
Deprecated.Gets the closure called when false.- Returns:
- the closure
- Since:
- Commons Collections 3.1
-