Class FunctionalTransformer<E,W>
java.lang.Object
com.aoapps.collections.transformers.AbstractTransformer<E,W>
com.aoapps.collections.transformers.FunctionalTransformer<E,W>
- All Implemented Interfaces:
Transformer<E,
W>
A functional transformer performs bi-directional conversion via provided reciprocal functions.
TODO: Add a one-way transformer that uses a single function and does not support inversion (and would thus fail most/all modifications)? This would provide for a one-way wrapper behavior similar to other one-way wrapper-based transformers (such as Guava).
- Author:
- AO Industries, Inc.
-
Field Summary
Modifier and TypeFieldDescriptionFields inherited from class com.aoapps.collections.transformers.AbstractTransformer
eClass, inverted, wClass
-
Constructor Summary
-
Method Summary
Methods inherited from class com.aoapps.collections.transformers.AbstractTransformer
invert, unbounded
-
Field Details
-
toWrapped
-
fromWrapped
-
-
Constructor Details
-
FunctionalTransformer
public FunctionalTransformer(Class<E> eClass, Class<W> wClass, Function<? super E, ? extends W> toWrapped, Function<? super W, ? extends E> fromWrapped) Creates a new bi-directional functional transformer.- Parameters:
eClass
- The wrapper typewClass
- The wrapped typetoWrapped
- Converts from wrapper to wrapped typefromWrapped
- Converts from wrapped to wrapper type
-
-
Method Details
-
toWrapped
- Specified by:
toWrapped
in interfaceTransformer<E,
W> - Specified by:
toWrapped
in classAbstractTransformer<E,
W>
-
fromWrapped
- Specified by:
fromWrapped
in interfaceTransformer<E,
W> - Specified by:
fromWrapped
in classAbstractTransformer<E,
W>
-