Package com.helixframework.mapper
Interface ToMapper<A,B>
- Type Parameters:
A- the source typeB- the target type
- All Known Subinterfaces:
Mapper<A,B>
- All Known Implementing Classes:
MapperAdapter
public interface ToMapper<A,B>
One-way mapper from
A to B.-
Method Summary
Modifier and TypeMethodDescriptionChains this mapper with the next mapper.default BMaps a value of typeAto typeB.to(A value, MappingContext ctx) Maps a value of typeAto typeBusing the supplied context.Maps all values in the provided iterable to a list.toAll(Iterable<? extends A> values, MappingContext ctx) Maps all values in the provided iterable to a list using the supplied context.default Collection<B>toAllPreservingType(Collection<? extends A> values) Maps all values in the provided iterable while preserving list/set semantics when possible.default Collection<B>toAllPreservingType(Collection<? extends A> values, MappingContext ctx) Maps all values in the provided iterable while preserving list/set semantics when possible.default <C extends Collection<B>>
CtoCollection(Iterable<? extends A> values, Supplier<C> collectionFactory) Maps all values in the provided iterable into a collection supplied by the caller.default <C extends Collection<B>>
CtoCollection(Iterable<? extends A> values, Supplier<C> collectionFactory, MappingContext ctx) Maps all values in the provided iterable into a collection supplied by the caller.Maps all values in the provided iterable to a set.toSet(Iterable<? extends A> values, MappingContext ctx) Maps all values in the provided iterable to a set using the supplied context.Maps the provided iterable to a stream.toStream(Iterable<? extends A> values, MappingContext ctx) Maps the provided iterable to a stream using the supplied context.toStream(Stream<? extends A> values, MappingContext ctx) Maps the provided stream using the supplied context.
-
Method Details
-
to
Maps a value of typeAto typeB.- Parameters:
value- the source value- Returns:
- the mapped value
-
to
Maps a value of typeAto typeBusing the supplied context.- Parameters:
value- the source valuectx- additional mapping context- Returns:
- the mapped value
-
toAll
Maps all values in the provided iterable to a list.- Parameters:
values- the values to map- Returns:
- the mapped values
-
toAll
Maps all values in the provided iterable to a list using the supplied context.- Parameters:
values- the values to mapctx- additional mapping context- Returns:
- the mapped values
-
toSet
Maps all values in the provided iterable to a set.- Parameters:
values- the values to map- Returns:
- the mapped values
-
toSet
Maps all values in the provided iterable to a set using the supplied context.- Parameters:
values- the values to mapctx- additional mapping context- Returns:
- the mapped values
-
toCollection
default <C extends Collection<B>> C toCollection(Iterable<? extends A> 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 mapcollectionFactory- the collection factory- Returns:
- the mapped values
-
toCollection
default <C extends Collection<B>> C toCollection(Iterable<? extends A> 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 mapcollectionFactory- the collection factoryctx- additional mapping context- Returns:
- the mapped values
-
toAllPreservingType
Maps all values in the provided iterable while preserving list/set semantics when possible.- Parameters:
values- the values to map- Returns:
- the mapped collection
-
toAllPreservingType
Maps all values in the provided iterable while preserving list/set semantics when possible.- Parameters:
values- the values to mapctx- additional mapping context- Returns:
- the mapped collection
-
toStream
Maps the provided iterable to a stream.- Parameters:
values- the values to map- Returns:
- the mapped stream
-
toStream
Maps the provided iterable to a stream using the supplied context.- Parameters:
values- the values to mapctx- additional mapping context- Returns:
- the mapped stream
-
toStream
Maps the provided stream using the supplied context.- Parameters:
values- the values to mapctx- additional mapping context- Returns:
- the mapped stream
-
andThen
Chains this mapper with the next mapper.- Type Parameters:
C- the final target type- Parameters:
next- the next mapper- Returns:
- the chained mapper
-