Package org.modelmapper
Class Converters.Collection
java.lang.Object
org.modelmapper.Converters.Collection
- Enclosing class:
- Converters
Provides helper methods to create converters for collection.
-
Method Summary
Modifier and TypeMethodDescriptionstatic <S> Converters.ChainableConverter<Collection<S>,
S> first()
Provides a helper method to create a collection converter that will get the first element of source collect and convert it.static <S,
D> Converter<Collection<S>, Collection<D>> map
(Converters.Converter<S, D> elementConverter) Provides a helper method to create a collection converter that will map each element based on theelementConverter
.
-
Method Details
-
map
public static <S,D> Converter<Collection<S>,Collection<D>> map(Converters.Converter<S, D> elementConverter) Provides a helper method to create a collection converter that will map each element based on theelementConverter
.using(Collection.map(String::toUpperCase)).map(); using(Collection.map(ele -> new Destination(ele)).map();
- Type Parameters:
S
- the source element typeD
- the destination element type- Parameters:
elementConverter
- the converter to map the source element to destination element- Returns:
- a Converter
-
first
Provides a helper method to create a collection converter that will get the first element of source collect and convert it.using(Collection.first().to(Destination.class).map();
- Type Parameters:
S
- the source type- Returns:
- a
ChainableConverter
-