Package org.apache.commons.collections4
Interface Transformer<T,R>
- Type Parameters:
T- The type of the input to the function.R- The type of the result of the function.
- All Superinterfaces:
Function<T,R>
- All Known Implementing Classes:
ChainedTransformer,CloneTransformer,ClosureTransformer,ConstantTransformer,ExceptionTransformer,FactoryTransformer,IfTransformer,InstantiateTransformer,InvokerTransformer,MapTransformer,NOPTransformer,PredicateTransformer,StringValueTransformer,SwitchTransformer
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Defines a functor interface implemented by classes that transform one object into another.
A Transformer converts the input object to the output object. The input object SHOULD be left unchanged. Transformers are typically used for type
conversions, or extracting data from an object.
Standard implementations of common transformers are provided by TransformerUtils. These include method invocation, returning a constant, cloning and
returning the string value.
- Since:
- 1.0 This will be deprecated in 5.0 in favor of
Function.
-
Method Summary
-
Method Details
-
apply
-
transform
Transforms the input object into some output object.The input object SHOULD be left unchanged.
- Parameters:
input- The object to be transformed, should be left unchanged.- Returns:
- A transformed object.
- Throws:
ClassCastException- (runtime) if the input is the wrong class.IllegalArgumentException- (runtime) if the input is invalid.FunctorException- (runtime) if the transform cannot be completed.
-