Interface FromMapper<A,B>

Type Parameters:
A - the target type
B - the source type
All Known Subinterfaces:
Mapper<A,B>
All Known Implementing Classes:
MapperAdapter

public interface FromMapper<A,B>
One-way reverse mapper from B to A.
  • Method Details

    • from

      default A from(B value)
      Maps a value of type B to type A.
      Parameters:
      value - the source value
      Returns:
      the mapped value
    • from

      A from(B value, MappingContext ctx)
      Maps a value of type B to type A using the supplied context.
      Parameters:
      value - the source value
      ctx - additional mapping context
      Returns:
      the mapped value
    • fromAll

      default List<A> fromAll(Iterable<? extends B> values)
      Maps all values in the provided iterable to a list.
      Parameters:
      values - the values to map
      Returns:
      the mapped values
    • fromAll

      default List<A> fromAll(Iterable<? extends B> values, MappingContext ctx)
      Maps all values in the provided iterable to a list using the supplied context.
      Parameters:
      values - the values to map
      ctx - additional mapping context
      Returns:
      the mapped values
    • fromSet

      default Set<A> fromSet(Iterable<? extends B> values)
      Maps all values in the provided iterable to a set.
      Parameters:
      values - the values to map
      Returns:
      the mapped values
    • fromSet

      default Set<A> fromSet(Iterable<? extends B> values, MappingContext ctx)
      Maps all values in the provided iterable to a set using the supplied context.
      Parameters:
      values - the values to map
      ctx - additional mapping context
      Returns:
      the mapped values
    • fromCollection

      default <C extends Collection<A>> C fromCollection(Iterable<? extends B> values, Supplier<C> collectionFactory)
      Maps all values in the provided iterable into a collection supplied by the caller.
      Type Parameters:
      C - the collection type
      Parameters:
      values - the values to map
      collectionFactory - the collection factory
      Returns:
      the mapped values
    • fromCollection

      default <C extends Collection<A>> C fromCollection(Iterable<? extends B> values, Supplier<C> collectionFactory, MappingContext ctx)
      Maps all values in the provided iterable into a collection supplied by the caller.
      Type Parameters:
      C - the collection type
      Parameters:
      values - the values to map
      collectionFactory - the collection factory
      ctx - additional mapping context
      Returns:
      the mapped values
    • fromAllPreservingType

      default Collection<A> fromAllPreservingType(Collection<? extends B> values)
      Maps all values while preserving list/set semantics when possible.
      Parameters:
      values - the values to map
      Returns:
      the mapped collection
    • fromAllPreservingType

      default Collection<A> fromAllPreservingType(Collection<? extends B> values, MappingContext ctx)
      Maps all values while preserving list/set semantics when possible.
      Parameters:
      values - the values to map
      ctx - additional mapping context
      Returns:
      the mapped collection
    • fromStream

      default Stream<A> fromStream(Iterable<? extends B> values)
      Maps the provided iterable to a stream.
      Parameters:
      values - the values to map
      Returns:
      the mapped stream
    • fromStream

      default Stream<A> fromStream(Iterable<? extends B> values, MappingContext ctx)
      Maps the provided iterable to a stream using the supplied context.
      Parameters:
      values - the values to map
      ctx - additional mapping context
      Returns:
      the mapped stream
    • fromStream

      default Stream<A> fromStream(Stream<? extends B> values, MappingContext ctx)
      Maps the provided stream using the supplied context.
      Parameters:
      values - the values to map
      ctx - additional mapping context
      Returns:
      the mapped stream
    • andThen

      default <C> FromMapper<C,B> andThen(FromMapper<? extends C,? super A> next)
      Chains this mapper with the next reverse mapper.
      Type Parameters:
      C - the final target type
      Parameters:
      next - the next mapper
      Returns:
      the chained reverse mapper