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 the
Closure ,
Predicate ,
Transformer and
Factory interfaces. |
Modifier and Type | Method and Description |
---|---|
static Closure |
ClosureUtils.asClosure(Transformer transformer)
Creates a Closure that calls a Transformer each time it is called.
|
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.chainedClosure(Collection closures)
Create a new Closure that calls each closure in turn, passing the
result into the next closure.
|
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 closure
count 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.
|
Modifier and Type | Method and 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 closure
count 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.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.
|
Modifier and Type | Class and 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.
|
Modifier and Type | Field and Description |
---|---|
static Closure |
NOPClosure.INSTANCE
Singleton predicate instance
|
static Closure |
ExceptionClosure.INSTANCE
Singleton predicate instance
|
Modifier and Type | Method and Description |
---|---|
Closure |
WhileClosure.getClosure()
Gets the closure.
|
Closure |
ForClosure.getClosure()
Gets the closure.
|
Closure |
ClosureTransformer.getClosure()
Gets the closure.
|
Closure[] |
SwitchClosure.getClosures()
Gets the closures, do not modify the array.
|
Closure[] |
ChainedClosure.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 |
NOPClosure.getInstance()
Factory returning the singleton instance.
|
static Closure |
ExceptionClosure.getInstance()
Factory returning the singleton instance.
|
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 |
ChainedClosure.getInstance(Collection closures)
Create a new Closure that calls each closure in turn, passing the
result into the next closure.
|
static Closure |
ForClosure.getInstance(int count,
Closure closure)
Factory method that performs validation.
|
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 |
IfClosure.getInstance(Predicate predicate,
Closure trueClosure)
Factory method that performs validation.
|
static Closure |
WhileClosure.getInstance(Predicate predicate,
Closure closure,
boolean doLoop)
Factory method that performs validation.
|
static Closure |
IfClosure.getInstance(Predicate predicate,
Closure trueClosure,
Closure falseClosure)
Factory method that performs validation.
|
static Closure |
TransformerClosure.getInstance(Transformer transformer)
Factory method that performs validation.
|
Closure |
IfClosure.getTrueClosure()
Gets the closure called when true.
|
Modifier and Type | Method and Description |
---|---|
static Transformer |
ClosureTransformer.getInstance(Closure closure)
Factory method that performs validation.
|
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 |
ForClosure.getInstance(int count,
Closure closure)
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 |
SwitchClosure.getInstance(Predicate[] predicates,
Closure[] closures,
Closure defaultClosure)
Factory method that performs validation and copies the parameter arrays.
|
static Closure |
IfClosure.getInstance(Predicate predicate,
Closure trueClosure)
Factory method that performs validation.
|
static Closure |
WhileClosure.getInstance(Predicate predicate,
Closure closure,
boolean doLoop)
Factory method that performs validation.
|
static Closure |
IfClosure.getInstance(Predicate predicate,
Closure trueClosure,
Closure falseClosure)
Factory method that performs validation.
|
Constructor and 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.
|
SwitchClosure(Predicate[] predicates,
Closure[] closures,
Closure defaultClosure)
Constructor that performs no validation.
|
WhileClosure(Predicate predicate,
Closure closure,
boolean doLoop)
Constructor that performs no validation.
|
Copyright © 2001–2015 The Apache Software Foundation. All rights reserved.