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.bag | |
org.apache.commons.collections.buffer |
This package contains implementations of the
Buffer interface. |
org.apache.commons.collections.collection |
This package contains implementations of the
Collection interface. |
org.apache.commons.collections.comparators |
This package contains implementations of the
Comparator interface. |
org.apache.commons.collections.functors |
This package contains implementations of the
Closure ,
Predicate ,
Transformer and
Factory interfaces. |
org.apache.commons.collections.iterators |
This package contains implementations of the
Iterator interface. |
org.apache.commons.collections.list |
This package contains implementations of the
List interface. |
org.apache.commons.collections.map | |
org.apache.commons.collections.set |
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 Transformer |
TransformerUtils.asTransformer(Factory factory)
Creates a Transformer that calls a Factory each time the transformer is used.
|
static Transformer |
TransformerUtils.asTransformer(Predicate predicate)
Creates a Transformer that calls a Predicate each time the transformer is used.
|
static Transformer |
TransformerUtils.chainedTransformer(Collection transformers)
Create a new Transformer that calls each transformer in turn, passing the
result into the next transformer.
|
static Transformer |
TransformerUtils.chainedTransformer(Transformer[] transformers)
Create a new Transformer that calls each transformer in turn, passing the
result into the next transformer.
|
static Transformer |
TransformerUtils.chainedTransformer(Transformer transformer1,
Transformer transformer2)
Create a new Transformer that calls two transformers, passing the result of
the first into the second.
|
static Transformer |
TransformerUtils.cloneTransformer()
Gets a transformer that returns a clone of the input
object.
|
static Transformer |
TransformerUtils.constantTransformer(Object constantToReturn)
Creates a Transformer that will return the same object each time the
transformer is used.
|
static Transformer |
TransformerUtils.exceptionTransformer()
Gets a transformer that always throws an exception.
|
protected Transformer |
BeanMap.getTypeTransformer(Class aType)
Deprecated.
Returns a transformer for the given primitive type.
|
static Transformer |
TransformerUtils.instantiateTransformer()
Gets a Transformer that expects an input Class object that it will instantiate.
|
static Transformer |
TransformerUtils.instantiateTransformer(Class[] paramTypes,
Object[] args)
Creates a Transformer that expects an input Class object that it will
instantiate.
|
static Transformer |
TransformerUtils.invokerTransformer(String methodName)
Gets a Transformer that invokes a method on the input object.
|
static Transformer |
TransformerUtils.invokerTransformer(String methodName,
Class[] paramTypes,
Object[] args)
Gets a Transformer that invokes a method on the input object.
|
static Transformer |
TransformerUtils.mapTransformer(Map map)
Creates a Transformer that uses the passed in Map to transform the input
object (as a simple lookup).
|
static Transformer |
TransformerUtils.nopTransformer()
Gets a transformer that returns the input object.
|
static Transformer |
TransformerUtils.nullTransformer()
Gets a transformer that always returns null.
|
static Transformer |
TransformerUtils.stringValueTransformer()
Gets a transformer that returns a
java.lang.String
representation of the input object. |
static Transformer |
TransformerUtils.switchMapTransformer(Map objectsAndTransformers)
Create a new Transformer that uses the input object as a key to find the
transformer to call.
|
static Transformer |
TransformerUtils.switchTransformer(Map predicatesAndTransformers)
Create a new Transformer that calls one of the transformers depending
on the predicates.
|
static Transformer |
TransformerUtils.switchTransformer(Predicate[] predicates,
Transformer[] transformers)
Create a new Transformer that calls one of the transformers depending
on the predicates.
|
static Transformer |
TransformerUtils.switchTransformer(Predicate[] predicates,
Transformer[] transformers,
Transformer defaultTransformer)
Create a new Transformer that calls one of the transformers depending
on the predicates.
|
static Transformer |
TransformerUtils.switchTransformer(Predicate predicate,
Transformer trueTransformer,
Transformer falseTransformer)
Create a new Transformer that calls one of two transformers depending
on the specified predicate.
|
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 Predicate |
PredicateUtils.asPredicate(Transformer transformer)
Create a new Predicate that wraps a Transformer.
|
static Transformer |
TransformerUtils.chainedTransformer(Transformer[] transformers)
Create a new Transformer that calls each transformer in turn, passing the
result into the next transformer.
|
static Transformer |
TransformerUtils.chainedTransformer(Transformer transformer1,
Transformer transformer2)
Create a new Transformer that calls two transformers, passing the result of
the first into the second.
|
static Collection |
CollectionUtils.collect(Collection inputCollection,
Transformer transformer)
Returns a new Collection consisting of the elements of inputCollection transformed
by the given transformer.
|
static Collection |
CollectionUtils.collect(Collection inputCollection,
Transformer transformer,
Collection outputCollection)
Transforms all elements from inputCollection with the given transformer
and adds them to the outputCollection.
|
static Collection |
CollectionUtils.collect(Iterator inputIterator,
Transformer transformer)
Transforms all elements from the inputIterator with the given transformer
and adds them to the outputCollection.
|
static Collection |
CollectionUtils.collect(Iterator inputIterator,
Transformer transformer,
Collection outputCollection)
Transforms all elements from the inputIterator with the given transformer
and adds them to the outputCollection.
|
static Map |
MapUtils.lazyMap(Map map,
Transformer transformerFactory)
Returns a "lazy" map whose values will be created on demand.
|
static SortedMap |
MapUtils.lazySortedMap(SortedMap map,
Transformer transformerFactory)
Returns a "lazy" sorted map whose values will be created on demand.
|
static Iterator |
IteratorUtils.objectGraphIterator(Object root,
Transformer transformer)
Gets an iterator that operates over an object graph.
|
static Transformer |
TransformerUtils.switchTransformer(Predicate[] predicates,
Transformer[] transformers)
Create a new Transformer that calls one of the transformers depending
on the predicates.
|
static Transformer |
TransformerUtils.switchTransformer(Predicate[] predicates,
Transformer[] transformers,
Transformer defaultTransformer)
Create a new Transformer that calls one of the transformers depending
on the predicates.
|
static Transformer |
TransformerUtils.switchTransformer(Predicate[] predicates,
Transformer[] transformers,
Transformer defaultTransformer)
Create a new Transformer that calls one of the transformers depending
on the predicates.
|
static Transformer |
TransformerUtils.switchTransformer(Predicate predicate,
Transformer trueTransformer,
Transformer falseTransformer)
Create a new Transformer that calls one of two transformers depending
on the specified predicate.
|
static void |
CollectionUtils.transform(Collection collection,
Transformer transformer)
Transform the collection by applying a Transformer to each element.
|
static Bag |
BagUtils.transformedBag(Bag bag,
Transformer transformer)
Returns a transformed bag backed by the given bag.
|
static Buffer |
BufferUtils.transformedBuffer(Buffer buffer,
Transformer transformer)
Returns a transformed buffer backed by the given buffer.
|
static Collection |
CollectionUtils.transformedCollection(Collection collection,
Transformer transformer)
Returns a transformed bag backed by the given collection.
|
static Comparator |
ComparatorUtils.transformedComparator(Comparator comparator,
Transformer transformer)
Gets a Comparator that passes transformed objects to the given comparator.
|
static Iterator |
IteratorUtils.transformedIterator(Iterator iterator,
Transformer transform)
Gets an iterator that transforms the elements of another iterator.
|
static List |
ListUtils.transformedList(List list,
Transformer transformer)
Returns a transformed list backed by the given list.
|
static Map |
MapUtils.transformedMap(Map map,
Transformer keyTransformer,
Transformer valueTransformer)
Returns a transformed map backed by the given map.
|
static Predicate |
PredicateUtils.transformedPredicate(Transformer transformer,
Predicate predicate)
Creates a predicate that transforms the input object before passing it
to the predicate.
|
static Set |
SetUtils.transformedSet(Set set,
Transformer transformer)
Returns a transformed set backed by the given set.
|
static SortedBag |
BagUtils.transformedSortedBag(SortedBag bag,
Transformer transformer)
Returns a transformed sorted bag backed by the given bag.
|
static SortedMap |
MapUtils.transformedSortedMap(SortedMap map,
Transformer keyTransformer,
Transformer valueTransformer)
Returns a transformed sorted map backed by the given map.
|
static SortedSet |
SetUtils.transformedSortedSet(SortedSet set,
Transformer transformer)
Returns a transformed sorted set backed by the given set.
|
Modifier and Type | Method and Description |
---|---|
static Bag |
TransformedBag.decorate(Bag bag,
Transformer transformer)
Factory method to create a transforming bag.
|
static SortedBag |
TransformedSortedBag.decorate(SortedBag bag,
Transformer transformer)
Factory method to create a transforming sorted bag.
|
Constructor and Description |
---|
TransformedBag(Bag bag,
Transformer transformer)
Constructor that wraps (not copies).
|
TransformedSortedBag(SortedBag bag,
Transformer transformer)
Constructor that wraps (not copies).
|
Modifier and Type | Method and Description |
---|---|
static Buffer |
TransformedBuffer.decorate(Buffer buffer,
Transformer transformer)
Factory method to create a transforming buffer.
|
Constructor and Description |
---|
TransformedBuffer(Buffer buffer,
Transformer transformer)
Constructor that wraps (not copies).
|
Modifier and Type | Field and Description |
---|---|
protected Transformer |
TransformedCollection.transformer
The transformer to use
|
Modifier and Type | Method and Description |
---|---|
static Collection |
TransformedCollection.decorate(Collection coll,
Transformer transformer)
Factory method to create a transforming collection.
|
Constructor and Description |
---|
TransformedCollection(Collection coll,
Transformer transformer)
Constructor that wraps (not copies).
|
Modifier and Type | Field and Description |
---|---|
protected Transformer |
TransformingComparator.transformer
The transformer being used.
|
Constructor and Description |
---|
TransformingComparator(Transformer transformer)
Constructs an instance with the given Transformer and a
ComparableComparator . |
TransformingComparator(Transformer transformer,
Comparator decorated)
Constructs an instance with the given Transformer and Comparator.
|
Modifier and Type | Class and Description |
---|---|
class |
ChainedTransformer
Transformer implementation that chains the specified transformers together.
|
class |
CloneTransformer
Transformer implementation that returns a clone of the input object.
|
class |
ClosureTransformer
Transformer implementation that calls a Closure using the input object
and then returns the input.
|
class |
ConstantTransformer
Transformer implementation that returns the same constant each time.
|
class |
ExceptionTransformer
Transformer implementation that always throws an exception.
|
class |
FactoryTransformer
Transformer implementation that calls a Factory and returns the result.
|
class |
InstantiateTransformer
Transformer implementation that creates a new object instance by reflection.
|
class |
InvokerTransformer
Transformer implementation that creates a new object instance by reflection.
|
class |
MapTransformer
Transformer implementation that returns the value held in a specified map
using the input parameter as a key.
|
class |
NOPTransformer
Transformer implementation that does nothing.
|
class |
PredicateTransformer
Transformer implementation that calls a Predicate using the input object
and then returns the input.
|
class |
StringValueTransformer
Transformer implementation that returns the result of calling
String.valueOf on the input object. |
class |
SwitchTransformer
Transformer implementation calls the transformer whose predicate returns true,
like a switch statement.
|
Modifier and Type | Field and Description |
---|---|
static Transformer |
StringValueTransformer.INSTANCE
Singleton predicate instance
|
static Transformer |
CloneTransformer.INSTANCE
Singleton predicate instance
|
static Transformer |
ExceptionTransformer.INSTANCE
Singleton predicate instance
|
static Transformer |
NOPTransformer.INSTANCE
Singleton predicate instance
|
static Transformer |
InstantiateTransformer.NO_ARG_INSTANCE
Singleton instance that uses the no arg constructor
|
static Transformer |
ConstantTransformer.NULL_INSTANCE
Returns null each time
|
Modifier and Type | Method and Description |
---|---|
Transformer |
SwitchTransformer.getDefaultTransformer()
Gets the default transformer.
|
static Transformer |
StringValueTransformer.getInstance()
Factory returning the singleton instance.
|
static Transformer |
CloneTransformer.getInstance()
Factory returning the singleton instance.
|
static Transformer |
ExceptionTransformer.getInstance()
Factory returning the singleton instance.
|
static Transformer |
NOPTransformer.getInstance()
Factory returning the singleton instance.
|
static Transformer |
InstantiateTransformer.getInstance(Class[] paramTypes,
Object[] args)
Transformer method that performs validation.
|
static Transformer |
ClosureTransformer.getInstance(Closure closure)
Factory method that performs validation.
|
static Transformer |
ChainedTransformer.getInstance(Collection transformers)
Create a new Transformer that calls each transformer in turn, passing the
result into the next transformer.
|
static Transformer |
FactoryTransformer.getInstance(Factory factory)
Factory method that performs validation.
|
static Transformer |
SwitchTransformer.getInstance(Map predicatesAndTransformers)
Create a new Transformer that calls one of the transformers depending
on the predicates.
|
static Transformer |
MapTransformer.getInstance(Map map)
Factory to create the transformer.
|
static Transformer |
ConstantTransformer.getInstance(Object constantToReturn)
Transformer method that performs validation.
|
static Transformer |
PredicateTransformer.getInstance(Predicate predicate)
Factory method that performs validation.
|
static Transformer |
SwitchTransformer.getInstance(Predicate[] predicates,
Transformer[] transformers,
Transformer defaultTransformer)
Factory method that performs validation and copies the parameter arrays.
|
static Transformer |
InvokerTransformer.getInstance(String methodName)
Gets an instance of this transformer calling a specific method with no arguments.
|
static Transformer |
InvokerTransformer.getInstance(String methodName,
Class[] paramTypes,
Object[] args)
Gets an instance of this transformer calling a specific method with specific values.
|
static Transformer |
ChainedTransformer.getInstance(Transformer[] transformers)
Factory method that performs validation and copies the parameter array.
|
static Transformer |
ChainedTransformer.getInstance(Transformer transformer1,
Transformer transformer2)
Factory method that performs validation.
|
Transformer |
TransformerPredicate.getTransformer()
Gets the transformer.
|
Transformer |
TransformerClosure.getTransformer()
Gets the transformer.
|
Transformer |
TransformedPredicate.getTransformer()
Gets the transformer in use.
|
Transformer[] |
SwitchTransformer.getTransformers()
Gets the transformers, do not modify the array.
|
Transformer[] |
ChainedTransformer.getTransformers()
Gets the transformers, do not modify the array.
|
Modifier and Type | Method and Description |
---|---|
static Transformer |
SwitchTransformer.getInstance(Predicate[] predicates,
Transformer[] transformers,
Transformer defaultTransformer)
Factory method that performs validation and copies the parameter arrays.
|
static Transformer |
SwitchTransformer.getInstance(Predicate[] predicates,
Transformer[] transformers,
Transformer defaultTransformer)
Factory method that performs validation and copies the parameter arrays.
|
static Predicate |
TransformerPredicate.getInstance(Transformer transformer)
Factory to create the predicate.
|
static Closure |
TransformerClosure.getInstance(Transformer transformer)
Factory method that performs validation.
|
static Transformer |
ChainedTransformer.getInstance(Transformer[] transformers)
Factory method that performs validation and copies the parameter array.
|
static Predicate |
TransformedPredicate.getInstance(Transformer transformer,
Predicate predicate)
Factory to create the predicate.
|
static Transformer |
ChainedTransformer.getInstance(Transformer transformer1,
Transformer transformer2)
Factory method that performs validation.
|
Constructor and Description |
---|
ChainedTransformer(Transformer[] transformers)
Constructor that performs no validation.
|
SwitchTransformer(Predicate[] predicates,
Transformer[] transformers,
Transformer defaultTransformer)
Constructor that performs no validation.
|
SwitchTransformer(Predicate[] predicates,
Transformer[] transformers,
Transformer defaultTransformer)
Constructor that performs no validation.
|
TransformedPredicate(Transformer transformer,
Predicate predicate)
Constructor that performs no validation.
|
TransformerClosure(Transformer transformer)
Constructor that performs no validation.
|
TransformerPredicate(Transformer transformer)
Constructor that performs no validation.
|
Modifier and Type | Field and Description |
---|---|
protected Transformer |
ObjectGraphIterator.transformer
The transformer to use
|
Modifier and Type | Method and Description |
---|---|
Transformer |
TransformIterator.getTransformer()
Gets the transformer this iterator is using.
|
Modifier and Type | Method and Description |
---|---|
void |
TransformIterator.setTransformer(Transformer transformer)
Sets the transformer this the iterator to use.
|
Constructor and Description |
---|
ObjectGraphIterator(Object root,
Transformer transformer)
Constructs an ObjectGraphIterator using a root object and transformer.
|
TransformIterator(Iterator iterator,
Transformer transformer)
Constructs a new
TransformIterator that will use the
given iterator and transformer. |
Modifier and Type | Method and Description |
---|---|
static List |
TransformedList.decorate(List list,
Transformer transformer)
Factory method to create a transforming list.
|
Constructor and Description |
---|
TransformedList(List list,
Transformer transformer)
Constructor that wraps (not copies).
|
Modifier and Type | Field and Description |
---|---|
protected Transformer |
LazyMap.factory
The factory to use to construct elements
|
protected Transformer |
TransformedMap.keyTransformer
The transformer to use for the key
|
protected Transformer |
TransformedMap.valueTransformer
The transformer to use for the value
|
Modifier and Type | Method and Description |
---|---|
static Map |
DefaultedMap.decorate(Map map,
Transformer factory)
Factory method to create a defaulting map.
|
static Map |
LazyMap.decorate(Map map,
Transformer factory)
Factory method to create a lazily instantiated map.
|
static Map |
TransformedMap.decorate(Map map,
Transformer keyTransformer,
Transformer valueTransformer)
Factory method to create a transforming map.
|
static SortedMap |
LazySortedMap.decorate(SortedMap map,
Transformer factory)
Factory method to create a lazily instantiated sorted map.
|
static SortedMap |
TransformedSortedMap.decorate(SortedMap map,
Transformer keyTransformer,
Transformer valueTransformer)
Factory method to create a transforming sorted map.
|
static Map |
TransformedMap.decorateTransform(Map map,
Transformer keyTransformer,
Transformer valueTransformer)
Factory method to create a transforming map that will transform
existing contents of the specified map.
|
static SortedMap |
TransformedSortedMap.decorateTransform(SortedMap map,
Transformer keyTransformer,
Transformer valueTransformer)
Factory method to create a transforming sorted map that will transform
existing contents of the specified map.
|
Constructor and Description |
---|
LazyMap(Map map,
Transformer factory)
Constructor that wraps (not copies).
|
LazySortedMap(SortedMap map,
Transformer factory)
Constructor that wraps (not copies).
|
TransformedMap(Map map,
Transformer keyTransformer,
Transformer valueTransformer)
Constructor that wraps (not copies).
|
TransformedSortedMap(SortedMap map,
Transformer keyTransformer,
Transformer valueTransformer)
Constructor that wraps (not copies).
|
Modifier and Type | Method and Description |
---|---|
static Set |
TransformedSet.decorate(Set set,
Transformer transformer)
Factory method to create a transforming set.
|
static SortedSet |
TransformedSortedSet.decorate(SortedSet set,
Transformer transformer)
Factory method to create a transforming sorted set.
|
Constructor and Description |
---|
TransformedSet(Set set,
Transformer transformer)
Constructor that wraps (not copies).
|
TransformedSortedSet(SortedSet set,
Transformer transformer)
Constructor that wraps (not copies).
|
Copyright © 2001–2015 The Apache Software Foundation. All rights reserved.