Package com.helixframework.mapper
Interface FromMapper<A,B>
- Type Parameters:
A- the target typeB- 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 Summary
Modifier and TypeMethodDescriptiondefault <C> FromMapper<C,B> andThen(FromMapper<? extends C, ? super A> next) Chains this mapper with the next reverse mapper.default AMaps a value of typeBto typeA.from(B value, MappingContext ctx) Maps a value of typeBto typeAusing the supplied context.Maps all values in the provided iterable to a list.fromAll(Iterable<? extends B> values, MappingContext ctx) Maps all values in the provided iterable to a list using the supplied context.default Collection<A>fromAllPreservingType(Collection<? extends B> values) Maps all values while preserving list/set semantics when possible.default Collection<A>fromAllPreservingType(Collection<? extends B> values, MappingContext ctx) Maps all values while preserving list/set semantics when possible.default <C extends Collection<A>>
CfromCollection(Iterable<? extends B> values, Supplier<C> collectionFactory) Maps all values in the provided iterable into a collection supplied by the caller.default <C extends Collection<A>>
CfromCollection(Iterable<? extends B> 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.fromSet(Iterable<? extends B> values, MappingContext ctx) Maps all values in the provided iterable to a set using the supplied context.fromStream(Iterable<? extends B> values) Maps the provided iterable to a stream.fromStream(Iterable<? extends B> values, MappingContext ctx) Maps the provided iterable to a stream using the supplied context.fromStream(Stream<? extends B> values, MappingContext ctx) Maps the provided stream using the supplied context.
-
Method Details
-
from
Maps a value of typeBto typeA.- Parameters:
value- the source value- Returns:
- the mapped value
-
from
Maps a value of typeBto typeAusing the supplied context.- Parameters:
value- the source valuectx- additional mapping context- Returns:
- the mapped value
-
fromAll
Maps all values in the provided iterable to a list.- Parameters:
values- the values to map- Returns:
- the mapped values
-
fromAll
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
-
fromSet
Maps all values in the provided iterable to a set.- Parameters:
values- the values to map- Returns:
- the mapped values
-
fromSet
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
-
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 mapcollectionFactory- 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 mapcollectionFactory- the collection factoryctx- additional mapping context- Returns:
- the mapped values
-
fromAllPreservingType
Maps all values while preserving list/set semantics when possible.- Parameters:
values- the values to map- Returns:
- the mapped collection
-
fromAllPreservingType
Maps all values while preserving list/set semantics when possible.- Parameters:
values- the values to mapctx- additional mapping context- Returns:
- the mapped collection
-
fromStream
Maps the provided iterable to a stream.- Parameters:
values- the values to map- Returns:
- the mapped stream
-
fromStream
Maps the provided iterable to a stream using the supplied context.- Parameters:
values- the values to mapctx- additional mapping context- Returns:
- the mapped stream
-
fromStream
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 reverse mapper.- Type Parameters:
C- the final target type- Parameters:
next- the next mapper- Returns:
- the chained reverse mapper
-