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>

public class FunctionalTransformer<E,W> extends AbstractTransformer<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 Details

    • toWrapped

      protected final Function<? super E,? extends W> toWrapped
    • fromWrapped

      protected final Function<? super W,? extends E> 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 type
      wClass - The wrapped type
      toWrapped - Converts from wrapper to wrapped type
      fromWrapped - Converts from wrapped to wrapper type
  • Method Details