Top Description Fields Constructors Methods
org.apache.commons.collections4.functors

public Class ChainedClosure<E>

extends Object
implements Closure<E>, Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable, org.apache.commons.collections4.Closure
Imports
java.io.Serializable, java.util.Collection, org.apache.commons.collections4.Closure

Closure implementation that chains the specified closures together.
Since
3.0

Field Summary

Modifier and TypeField and Description
private final Closure<? super E>[]
iClosures

The closures to call in turn

private static final long
serialVersionUID

Serial version UID

Constructor Summary

AccessConstructor and Description
private
ChainedClosure(final boolean
if true the input argument will be cloned
clone
,
final Closure<? super E>...
the closures to chain, no nulls
closures
)

Hidden constructor for the use by the static factory methods.

public
ChainedClosure(final Closure<? super E>...
the closures to chain, copied, no nulls
closures
)

Constructor that performs no validation.

Method Summary

Modifier and TypeMethod and Description
public static <
the type that the closure acts on
E
>
Closure<E>

Returns:

the chained closure
chainedClosure
(final Closure<? super E>...
the closures to chain, copied, no nulls
closures
)

Factory method that performs validation and copies the parameter array.

public static <
the type that the closure acts on
E
>
Closure<E>

Returns:

the chained closure
chainedClosure
(final Collection<? extends Closure<? super E>>
a collection of closures to chain
closures
)

Create a new Closure that calls each closure in turn, passing the result into the next closure.

public void
execute(final E
the input object passed to each closure
input
)

Implements org.apache.commons.collections4.Closure.execute.

Execute a list of closures.
public Closure<? super E>[]

Returns:

a copy of the closures
getClosures
()

Gets the closures.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

iClosuresback to summary
private final Closure<? super E>[] iClosures

The closures to call in turn

serialVersionUIDback to summary
private static final long serialVersionUID

Serial version UID

Constructor Detail

ChainedClosureback to summary
private ChainedClosure(final boolean clone, final Closure<? super E>... closures)

Hidden constructor for the use by the static factory methods.

Parameters
clone:boolean

if true the input argument will be cloned

closures:Closure<? super E>[]

the closures to chain, no nulls

ChainedClosureback to summary
public ChainedClosure(final Closure<? super E>... closures)

Constructor that performs no validation. Use chainedClosure if you want that.

Parameters
closures:Closure<? super E>[]

the closures to chain, copied, no nulls

Method Detail

chainedClosureback to summary
public static <E> Closure<E> chainedClosure(final Closure<? super E>... closures)

Factory method that performs validation and copies the parameter array.

Parameters
<E>
the type that the closure acts on
closures:Closure<? super E>[]

the closures to chain, copied, no nulls

Returns:Closure<E>

the chained closure

Exceptions
NullPointerException:
  • if the closures array is null
  • if any closure in the array is null
chainedClosureback to summary
public static <E> Closure<E> chainedClosure(final Collection<? extends Closure<? super E>> closures)

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
<E>
the type that the closure acts on
closures:Collection<? extends Closure<? super E>>

a collection of closures to chain

Returns:Closure<E>

the chained closure

Annotations
@SuppressWarnings:unchecked
Exceptions
NullPointerException:
  • if the closures collection is null
  • if any closure in the collection is null
executeback to summary
public void execute(final E input)

Implements org.apache.commons.collections4.Closure.execute.

Execute a list of closures.

Parameters
input:E

the input object passed to each closure

Annotations
@Override
getClosuresback to summary
public Closure<? super E>[] getClosures()

Gets the closures.

Returns:Closure<? super E>[]

a copy of the closures

Since
3.1