Class MapperAdapter<A,B>

java.lang.Object
com.helixframework.mapper.MapperAdapter<A,B>
Type Parameters:
A - the source type
B - the target type
All Implemented Interfaces:
FromMapper<A,B>, Mapper<A,B>, ToMapper<A,B>

public abstract class MapperAdapter<A,B> extends Object implements Mapper<A,B>
Convenience base class for context-aware mappers.

Implementations can override only the context-aware methods and still get the no-context overloads for free.

  • Constructor Details

    • MapperAdapter

      public MapperAdapter()
  • Method Details

    • to

      public B to(A value)
      Description copied from interface: ToMapper
      Maps a value of type A to type B.
      Specified by:
      to in interface ToMapper<A,B>
      Parameters:
      value - the source value
      Returns:
      the mapped value
    • to

      public B to(A value, MappingContext ctx)
      Description copied from interface: ToMapper
      Maps a value of type A to type B using the supplied context.
      Specified by:
      to in interface ToMapper<A,B>
      Parameters:
      value - the source value
      ctx - additional mapping context
      Returns:
      the mapped value
    • from

      public A from(B value)
      Description copied from interface: FromMapper
      Maps a value of type B to type A.
      Specified by:
      from in interface FromMapper<A,B>
      Parameters:
      value - the source value
      Returns:
      the mapped value
    • from

      public A from(B value, MappingContext ctx)
      Description copied from interface: FromMapper
      Maps a value of type B to type A using the supplied context.
      Specified by:
      from in interface FromMapper<A,B>
      Parameters:
      value - the source value
      ctx - additional mapping context
      Returns:
      the mapped value