# Package org.apache.commons.collections.functors

This package contains implementations of the `Closure`, `Predicate`, `Transformer` and `Factory` interfaces.

See: Description

- Interface Summary
  Interface | Description
  --- | ---
  PredicateDecorator | Defines a predicate that decorates one or more other predicates.

- Class Summary
  Class | Description
  --- | ---
  AllPredicate | Predicate implementation that returns true if all the predicates return true.
  AndPredicate | Predicate implementation that returns true if both the predicates return true.
  AnyPredicate | Predicate implementation that returns true if any of the predicates return true.
  ChainedClosure | Closure implementation that chains the specified closures together.
  ChainedTransformer | Transformer implementation that chains the specified transformers together.
  CloneTransformer | Transformer implementation that returns a clone of the input object.
  ClosureTransformer | Transformer implementation that calls a Closure using the input object and then returns the input.
  ConstantFactory | Factory implementation that returns the same constant each time.
  ConstantTransformer | Transformer implementation that returns the same constant each time.
  EqualPredicate | Predicate implementation that returns true if the input is the same object as the one stored in this predicate by equals.
  ExceptionClosure | Closure implementation that always throws an exception.
  ExceptionFactory | Factory implementation that always throws an exception.
  ExceptionPredicate | Predicate implementation that always throws an exception.
  ExceptionTransformer | Transformer implementation that always throws an exception.
  FactoryTransformer | Transformer implementation that calls a Factory and returns the result.
  FalsePredicate | Predicate implementation that always returns false.
  ForClosure | Closure implementation that calls another closure n times, like a for loop.
  IdentityPredicate | Predicate implementation that returns true if the input is the same object as the one stored in this predicate.
  IfClosure | Closure implementation acts as an if statement calling one or other closure based on a predicate.
  InstanceofPredicate | Predicate implementation that returns true if the input is an instanceof the type stored in this predicate.
  InstantiateFactory | Factory implementation that creates a new object instance by reflection.
  InstantiateTransformer | Transformer implementation that creates a new object instance by reflection.
  InvokerTransformer | Transformer implementation that creates a new object instance by reflection.
  MapTransformer | Transformer implementation that returns the value held in a specified map using the input parameter as a key.
  NonePredicate | Predicate implementation that returns true if none of the predicates return true.
  NOPClosure | Closure implementation that does nothing.
  NOPTransformer | Transformer implementation that does nothing.
  NotNullPredicate | Predicate implementation that returns true if the input is not null.
  NotPredicate | Predicate implementation that returns the opposite of the decorated predicate.
  NullIsExceptionPredicate | Predicate implementation that throws an exception if the input is null.
  NullIsFalsePredicate | Predicate implementation that returns false if the input is null.
  NullIsTruePredicate | Predicate implementation that returns true if the input is null.
  NullPredicate | Predicate implementation that returns true if the input is null.
  OnePredicate | Predicate implementation that returns true if only one of the predicates return true.
  OrPredicate | Predicate implementation that returns true if either of the predicates return true.
  PredicateTransformer | Transformer implementation that calls a Predicate using the input object and then returns the input.
  PrototypeFactory | Factory implementation that creates a new instance each time based on a prototype.
  StringValueTransformer | Transformer implementation that returns the result of calling `String.valueOf` on the input object.
  SwitchClosure | Closure implementation calls the closure whose predicate returns true, like a switch statement.
  SwitchTransformer | Transformer implementation calls the transformer whose predicate returns true, like a switch statement.
  TransformedPredicate | Predicate implementation that transforms the given object before invoking another `Predicate`.
  TransformerClosure | Closure implementation that calls a Transformer using the input object and ignore the result.
  TransformerPredicate | Predicate implementation that returns the result of a transformer.
  TruePredicate | Predicate implementation that always returns true.
  UniquePredicate | Predicate implementation that returns true the first time an object is passed into the predicate.
  WhileClosure | Closure implementation that executes a closure repeatedly until a condition is met, like a do-while or while loop.

## Package org.apache.commons.collections.functors Description

This package contains implementations of the `Closure`, `Predicate`, `Transformer` and `Factory` interfaces. These provide simple callbacks for processing with collections.

WARNING: from v3.2.2 onwards this several classes in this package will throw an `UnsupportedOperationException` when trying to serialize or de-serialize an instance to prevent potential remote code execution exploits.

Classes considered to be unsafe are:

- CloneTransformer
- ForClosure
- InstantiateFactory
- InstantiateTransformer
- InvokerTransformer
- PrototypeFactory$PrototypeCloneFactory
- PrototypeFactory$PrototypeSerializationFactory
- WhileClosure

In order to re-enable serialization support for these unsafe classes, the following system property can be used (via -Dproperty=true):

    org.apache.commons.collections.enableUnsafeSerialization

Be warned though that enabling serialization support for these unsafe classes makes your application vulnerable to known exploits and you must ensure that your application does not de-serialize objects from untrusted sources.

Copyright © 2001–2015 The Apache Software Foundation. All rights reserved.