Interface DataMapper
- All Known Subinterfaces:
CMSDataMapper,CMSDataMapper
- All Known Implementing Classes:
DefaultCMSDataMapper,DefaultCMSDataMapper,DefaultDataMapper
public interface DataMapper
Interface for data mapper that wraps
MapperFacade and adds property filtering.-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescription<S,D> void map(S sourceObject, D destinationObject) Maps the properties ofsourceObjectontodestinationObject.<S,D> void map(S sourceObject, D destinationObject, boolean mapNulls) Maps the properties ofsourceObjectontodestinationObject.<S,D> void Maps the properties ofsourceObjectontodestinationObject.<S,D> void Maps the properties ofsourceObjectontodestinationObject.<S,D> D Create and return a new instance of type D mapped with the properties ofsourceObject.<S,D> D Create and return a new instance of type D mapped with the specifiedfieldsofsourceObject.<S,D> D Create and return a new instance of type D mapped with the specifiedfieldsofsourceObject.<S,D> void mapAsCollection(Iterable<S> source, Collection<D> destination, Class<D> destinationClass, String fields) Map an iterable onto an existing collection<S,D> List<D> Maps the source Iterable into a new List parameterized bydestinationClass.<S,D> Set<D> Maps the source iterable into a new Set parameterized bydestinationClass.<S,D> void mapGeneric(S sourceObject, D destObject, Type[] sourceActualTypeArguments, Type[] destActualTypeArguments, String fields, Map<String, Class> destTypeVariableMap) Maps the properties ofsourceObjectontodestinationObject, usingsourceActualTypeArgumentsanddestActualTypeArgumentsto specify the arguments of parameterized types of the source and destination object.
-
Field Details
-
FIELD_SET_NAME
Field set name used in mapping context- See Also:
-
MAP_NULLS
Flag used in mapping context. Decides whether nulls are mapped or ignored.- See Also:
-
FIELD_PREFIX
Field prefix added to destination object field name- See Also:
-
-
Method Details
-
map
Create and return a new instance of type D mapped with the properties ofsourceObject.- Parameters:
sourceObject- the object to map fromdestinationClass- the type of the new object to return- Returns:
- a new instance of type D mapped with the properties of
sourceObject
-
map
Create and return a new instance of type D mapped with the specifiedfieldsofsourceObject.- Parameters:
sourceObject- the object to map fromdestinationClass- the type of the new object to returnfields- comma-separated fields to map- Returns:
- a new instance of type D mapped with the
fieldsofsourceObject
-
map
Create and return a new instance of type D mapped with the specifiedfieldsofsourceObject.- Parameters:
sourceObject- the object to map fromdestinationClass- the type of the new object to returnfields- set of fully qualified field names to map- Returns:
- a new instance of type D mapped with the
fieldsofsourceObject
-
map
<S,D> void map(S sourceObject, D destinationObject) Maps the properties ofsourceObjectontodestinationObject.- Parameters:
sourceObject- the object from which to read the propertiesdestinationObject- the object onto which the properties should be mapped
-
map
<S,D> void map(S sourceObject, D destinationObject, boolean mapNulls) Maps the properties ofsourceObjectontodestinationObject.- Parameters:
sourceObject- the object from which to read the propertiesdestinationObject- the object onto which the properties should be mappedmapNulls- controls whether nulls are mapped or ignored
-
map
Maps the properties ofsourceObjectontodestinationObject.- Parameters:
sourceObject- the object from which to read the propertiesdestinationObject- the object onto which the properties should be mappedfields- comma-separated fields to map
-
map
Maps the properties ofsourceObjectontodestinationObject.- Parameters:
sourceObject- the object from which to read the propertiesdestinationObject- the object onto which the properties should be mappedfields- comma-separated fields to mapmapNulls- controls whether nulls are mapped or ignored
-
mapAsSet
Maps the source iterable into a new Set parameterized bydestinationClass.- Parameters:
source- the Iterable from which to mapdestinationClass- the type of elements to be contained in the returned Set.fields- comma-separated fields to map- Returns:
- a new Set containing elements of type
destinationClassmapped from the elements ofsource.
-
mapAsList
Maps the source Iterable into a new List parameterized bydestinationClass.- Parameters:
source- the Iterable from which to mapdestinationClass- the type of elements to be contained in the returned Set.fields- comma-separated fields to map- Returns:
- a new List containing elements of type
destinationClassmapped from the elements ofsource.
-
mapAsCollection
<S,D> void mapAsCollection(Iterable<S> source, Collection<D> destination, Class<D> destinationClass, String fields) Map an iterable onto an existing collection- Parameters:
source- the source iterabledestination- the destination collectiondestinationClass- the type of elements in the destinationfields- comma-separated fields to map
-
mapGeneric
<S,D> void mapGeneric(S sourceObject, D destObject, Type[] sourceActualTypeArguments, Type[] destActualTypeArguments, String fields, Map<String, Class> destTypeVariableMap) Maps the properties ofsourceObjectontodestinationObject, usingsourceActualTypeArgumentsanddestActualTypeArgumentsto specify the arguments of parameterized types of the source and destination object.- Parameters:
sourceObject- the object from which to read the propertiesdestObject- the object onto which the properties should be mappedsourceActualTypeArguments- arguments of source type
e.g. if we have type class like ProductSearchPageData<SearchStateData, ProductData> we should give {SearchStateData.class,ProductData.class}destActualTypeArguments- arguments of dest type<br\> e.g. if we have type class like ProductSearchPageData<SearchStateData, ProductData> we should give {SearchStateData.class,ProductData.class}fields- comma-separated fields to mapdestTypeVariableMap- - map containing information about types used in generic class
e.g. if we have type class like ProductSearchPageData<STATE, RESULT> we should give map like {STATE=SearchStateData.class, RESULT=ProductData.class}
-