Uses of Interface
org.apache.commons.collections.Closure
-
Packages that use Closure Package Description org.apache.commons.collections This package contains the interfaces and utilities shared across all the subpackages of this component.org.apache.commons.collections.functors This package contains implementations of theClosure
,Predicate
,Transformer
andFactory
interfaces. -
-
Uses of Closure in org.apache.commons.collections
Methods in org.apache.commons.collections that return Closure Modifier and Type Method Description static Closure
ClosureUtils. asClosure(Transformer transformer)
Creates a Closure that calls a Transformer each time it is called.static Closure
ClosureUtils. chainedClosure(Collection closures)
Create a new Closure that calls each closure in turn, passing the result into the next closure.static Closure
ClosureUtils. chainedClosure(Closure[] closures)
Create a new Closure that calls each closure in turn, passing the result into the next closure.static Closure
ClosureUtils. chainedClosure(Closure closure1, Closure closure2)
Create a new Closure that calls two Closures, passing the result of the first into the second.static Closure
ClosureUtils. doWhileClosure(Closure closure, Predicate predicate)
Creates a Closure that will call the closure once and then repeatedly until the predicate returns false.static Closure
ClosureUtils. exceptionClosure()
Gets a Closure that always throws an exception.static Closure
ClosureUtils. forClosure(int count, Closure closure)
Creates a Closure that will call the closurecount
times.static Closure
ClosureUtils. ifClosure(Predicate predicate, Closure trueClosure)
Create a new Closure that calls another closure based on the result of the specified predicate.static Closure
ClosureUtils. ifClosure(Predicate predicate, Closure trueClosure, Closure falseClosure)
Create a new Closure that calls one of two closures depending on the specified predicate.static Closure
ClosureUtils. invokerClosure(String methodName)
Creates a Closure that will invoke a specific method on the closure's input object by reflection.static Closure
ClosureUtils. invokerClosure(String methodName, Class[] paramTypes, Object[] args)
Creates a Closure that will invoke a specific method on the closure's input object by reflection.static Closure
ClosureUtils. nopClosure()
Gets a Closure that will do nothing.static Closure
ClosureUtils. switchClosure(Map predicatesAndClosures)
Create a new Closure that calls one of the closures depending on the predicates.static Closure
ClosureUtils. switchClosure(Predicate[] predicates, Closure[] closures)
Create a new Closure that calls one of the closures depending on the predicates.static Closure
ClosureUtils. switchClosure(Predicate[] predicates, Closure[] closures, Closure defaultClosure)
Create a new Closure that calls one of the closures depending on the predicates.static Closure
ClosureUtils. switchMapClosure(Map objectsAndClosures)
Create a new Closure that uses the input object as a key to find the closure to call.static Closure
ClosureUtils. whileClosure(Predicate predicate, Closure closure)
Creates a Closure that will call the closure repeatedly until the predicate returns false.Methods in org.apache.commons.collections with parameters of type Closure Modifier and Type Method Description static Transformer
TransformerUtils. asTransformer(Closure closure)
Creates a Transformer that calls a Closure each time the transformer is used.static Closure
ClosureUtils. chainedClosure(Closure[] closures)
Create a new Closure that calls each closure in turn, passing the result into the next closure.static Closure
ClosureUtils. chainedClosure(Closure closure1, Closure closure2)
Create a new Closure that calls two Closures, passing the result of the first into the second.static Closure
ClosureUtils. doWhileClosure(Closure closure, Predicate predicate)
Creates a Closure that will call the closure once and then repeatedly until the predicate returns false.static void
CollectionUtils. forAllDo(Collection collection, Closure closure)
Executes the given closure on each element in the collection.static Closure
ClosureUtils. forClosure(int count, Closure closure)
Creates a Closure that will call the closurecount
times.static Closure
ClosureUtils. ifClosure(Predicate predicate, Closure trueClosure)
Create a new Closure that calls another closure based on the result of the specified predicate.static Closure
ClosureUtils. ifClosure(Predicate predicate, Closure trueClosure, Closure falseClosure)
Create a new Closure that calls one of two closures depending on the specified predicate.static Closure
ClosureUtils. switchClosure(Predicate[] predicates, Closure[] closures)
Create a new Closure that calls one of the closures depending on the predicates.static Closure
ClosureUtils. switchClosure(Predicate[] predicates, Closure[] closures, Closure defaultClosure)
Create a new Closure that calls one of the closures depending on the predicates.static Closure
ClosureUtils. whileClosure(Predicate predicate, Closure closure)
Creates a Closure that will call the closure repeatedly until the predicate returns false. -
Uses of Closure in org.apache.commons.collections.functors
Classes in org.apache.commons.collections.functors that implement Closure Modifier and Type Class Description class
ChainedClosure
Closure implementation that chains the specified closures together.class
ExceptionClosure
Closure implementation that always throws an exception.class
ForClosure
Closure implementation that calls another closure n times, like a for loop.class
IfClosure
Closure implementation acts as an if statement calling one or other closure based on a predicate.class
NOPClosure
Closure implementation that does nothing.class
SwitchClosure
Closure implementation calls the closure whose predicate returns true, like a switch statement.class
TransformerClosure
Closure implementation that calls a Transformer using the input object and ignore the result.class
WhileClosure
Closure implementation that executes a closure repeatedly until a condition is met, like a do-while or while loop.Fields in org.apache.commons.collections.functors declared as Closure Modifier and Type Field Description static Closure
ExceptionClosure. INSTANCE
Singleton predicate instancestatic Closure
NOPClosure. INSTANCE
Singleton predicate instanceMethods in org.apache.commons.collections.functors that return Closure Modifier and Type Method Description Closure
ClosureTransformer. getClosure()
Gets the closure.Closure
ForClosure. getClosure()
Gets the closure.Closure
WhileClosure. getClosure()
Gets the closure.Closure[]
ChainedClosure. getClosures()
Gets the closures, do not modify the array.Closure[]
SwitchClosure. getClosures()
Gets the closures, do not modify the array.Closure
SwitchClosure. getDefaultClosure()
Gets the default closure.Closure
IfClosure. getFalseClosure()
Gets the closure called when false.static Closure
ChainedClosure. getInstance(Collection closures)
Create a new Closure that calls each closure in turn, passing the result into the next closure.static Closure
ChainedClosure. getInstance(Closure[] closures)
Factory method that performs validation and copies the parameter array.static Closure
ChainedClosure. getInstance(Closure closure1, Closure closure2)
Factory method that performs validation.static Closure
ExceptionClosure. getInstance()
Factory returning the singleton instance.static Closure
ForClosure. getInstance(int count, Closure closure)
Factory method that performs validation.static Closure
IfClosure. getInstance(Predicate predicate, Closure trueClosure)
Factory method that performs validation.static Closure
IfClosure. getInstance(Predicate predicate, Closure trueClosure, Closure falseClosure)
Factory method that performs validation.static Closure
NOPClosure. getInstance()
Factory returning the singleton instance.static Closure
SwitchClosure. getInstance(Map predicatesAndClosures)
Create a new Closure that calls one of the closures depending on the predicates.static Closure
SwitchClosure. getInstance(Predicate[] predicates, Closure[] closures, Closure defaultClosure)
Factory method that performs validation and copies the parameter arrays.static Closure
TransformerClosure. getInstance(Transformer transformer)
Factory method that performs validation.static Closure
WhileClosure. getInstance(Predicate predicate, Closure closure, boolean doLoop)
Factory method that performs validation.Closure
IfClosure. getTrueClosure()
Gets the closure called when true.Methods in org.apache.commons.collections.functors with parameters of type Closure Modifier and Type Method Description static Closure
ChainedClosure. getInstance(Closure[] closures)
Factory method that performs validation and copies the parameter array.static Closure
ChainedClosure. getInstance(Closure closure1, Closure closure2)
Factory method that performs validation.static Transformer
ClosureTransformer. getInstance(Closure closure)
Factory method that performs validation.static Closure
ForClosure. getInstance(int count, Closure closure)
Factory method that performs validation.static Closure
IfClosure. getInstance(Predicate predicate, Closure trueClosure)
Factory method that performs validation.static Closure
IfClosure. getInstance(Predicate predicate, Closure trueClosure, Closure falseClosure)
Factory method that performs validation.static Closure
SwitchClosure. getInstance(Predicate[] predicates, Closure[] closures, Closure defaultClosure)
Factory method that performs validation and copies the parameter arrays.static Closure
WhileClosure. getInstance(Predicate predicate, Closure closure, boolean doLoop)
Factory method that performs validation.Constructors in org.apache.commons.collections.functors with parameters of type Closure Constructor Description ChainedClosure(Closure[] closures)
Constructor that performs no validation.ClosureTransformer(Closure closure)
Constructor that performs no validation.ForClosure(int count, Closure closure)
Constructor that performs no validation.IfClosure(Predicate predicate, Closure trueClosure)
Constructor that performs no validation.IfClosure(Predicate predicate, Closure trueClosure, Closure falseClosure)
Constructor that performs no validation.SwitchClosure(Predicate[] predicates, Closure[] closures, Closure defaultClosure)
Constructor that performs no validation.WhileClosure(Predicate predicate, Closure closure, boolean doLoop)
Constructor that performs no validation.
-