Class ChainedClosure
java.lang.Object
org.apache.commons.collections.functors.ChainedClosure
- All Implemented Interfaces:
Serializable
,Closure
Closure implementation that chains the specified closures together.
- Since:
- Commons Collections 3.0
- Version:
- $Revision: 646777 $ $Date: 2008-04-10 14:33:15 +0200 (Thu, 10 Apr 2008) $
- Author:
- Stephen Colebourne
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Execute a list of closures.Closure[]
Gets the closures, do not modify the array.static Closure
getInstance
(Collection closures) Create a new Closure that calls each closure in turn, passing the result into the next closure.static Closure
getInstance
(Closure[] closures) Factory method that performs validation and copies the parameter array.static Closure
getInstance
(Closure closure1, Closure closure2) Factory method that performs validation.
-
Constructor Details
-
ChainedClosure
Constructor that performs no validation. UsegetInstance
if you want that.- Parameters:
closures
- the closures to chain, not copied, no nulls
-
-
Method Details
-
getInstance
Factory method that performs validation and copies the parameter array.- Parameters:
closures
- the closures to chain, copied, no nulls- Returns:
- the
chained
closure - Throws:
IllegalArgumentException
- if the closures array is nullIllegalArgumentException
- if any closure in the array is null
-
getInstance
Create a new Closure that calls each closure in turn, passing the result into the next closure. The ordering is that of the iterator() method on the collection.- Parameters:
closures
- a collection of closures to chain- Returns:
- the
chained
closure - Throws:
IllegalArgumentException
- if the closures collection is nullIllegalArgumentException
- if any closure in the collection is null
-
getInstance
Factory method that performs validation.- Parameters:
closure1
- the first closure, not nullclosure2
- the second closure, not null- Returns:
- the
chained
closure - Throws:
IllegalArgumentException
- if either closure is null
-
execute
Execute a list of closures. -
getClosures
Gets the closures, do not modify the array.- Returns:
- the closures
- Since:
- Commons Collections 3.1
-