- java.lang.Object
-
- com.remondis.remap.utils.mapOver.MapOver<R,T>
-
- Type Parameters:
T- The root bean type
public class MapOver<R,T> extends Object
A util class that supports mapping of objects of the same type while only specified properties are taken from source and will be overridden in the target object. This makes it easier to use attached JPA entities and only map over changes made in the source object. Handling attached entities with RE-Map is a little bit tricky when it comes to update operations, since RE-Map always creates a new object and the map-into method in the mapper does not perform a real recursive map-into.
Using the MapOver utility makes it possible to apply the following update strategy on attached entities:
REST --> DTO --> RE-Map --> new Entity instance (detached) * | Map-over selected attributes to perform a partial update on the attached entity+ | | V JPA-Repository --> findById --> Entity instance from DB (attached) --> em.update(entity);
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description <TT> MapOver<R,T>addPropertyAction(Function<T,TT> propertyExtractor, BiConsumer<T,TT> propertyWriter, VisitorFunction<T,TT> action)MapOver<R,R>build()static <R> MapOver<R,R>create(Class<R> beanType)<TT> MapOver<R,TT>goInto(Function<T,TT> propertyExtractor, BiConsumer<T,TT> propertyWriter, Class<TT> beanType)voidmapOver(T source, T target)<TT> MapOver<R,T>mapProperty(Function<T,TT> propertyExtractor, BiConsumer<T,TT> propertyWriter)
-
-
-
Method Detail
-
mapProperty
public <TT> MapOver<R,T> mapProperty(Function<T,TT> propertyExtractor, BiConsumer<T,TT> propertyWriter)
-
addPropertyAction
public <TT> MapOver<R,T> addPropertyAction(Function<T,TT> propertyExtractor, BiConsumer<T,TT> propertyWriter, VisitorFunction<T,TT> action)
-
goInto
public <TT> MapOver<R,TT> goInto(Function<T,TT> propertyExtractor, BiConsumer<T,TT> propertyWriter, Class<TT> beanType)
-
-