Package com._1c.g5.aef2.mappers
Class OneWayMapper<M,V>
java.lang.Object
com._1c.g5.aef2.mappers.OneWayMapper<M,V>
- All Implemented Interfaces:
IMapper<M,V>
- Direct Known Subclasses:
OneWayLabelMapper
Caching one-way mapper from model to its projected view.
- See Also:
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <M,V> OneWayMapper<M, V> Static helper method to create aOneWayMapper, given a lambda model to view converter.protected abstract VcreateModelToView(M modelValue) Creates the view value if it's not found in the cache.mapModelToView(M modelValue) Maps the model value to some projected view value.mapViewToModel(V viewValue) Maps the view value to associated model value.
-
Constructor Details
-
OneWayMapper
public OneWayMapper()
-
-
Method Details
-
create
Static helper method to create aOneWayMapper, given a lambda model to view converter.- Parameters:
modelToViewFunction- lambda model to view converter, cannot benull- Returns:
- created
OneWayMapper
-
mapModelToView
Description copied from interface:IMapperMaps the model value to some projected view value.- Specified by:
mapModelToViewin interfaceIMapper<M,V> - Parameters:
modelValue- the model value to map.- Returns:
- mapped value.
-
mapViewToModel
Description copied from interface:IMapperMaps the view value to associated model value.- Specified by:
mapViewToModelin interfaceIMapper<M,V> - Parameters:
viewValue- the view value to map.- Returns:
- mapped value.
-
createModelToView
Creates the view value if it's not found in the cache.- Parameters:
modelValue- the model value to create mapping for.- Returns:
- created view value.
-