Interface DataMapper
-
- All Known Subinterfaces:
CMSDataMapper
- All Known Implementing Classes:
DefaultCMSDataMapper
,DefaultDataMapper
public interface DataMapper
Interface for data mapper that wrapsMapperFacade
and adds property filtering.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
FIELD_PREFIX
Field prefix added to destination object field namestatic java.lang.String
FIELD_SET_NAME
Field set name used in mapping contextstatic java.lang.String
MAP_NULLS
Flag used in mapping context.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <S,D>
voidmap(S sourceObject, D destinationObject)
Maps the properties ofsourceObject
ontodestinationObject
.<S,D>
voidmap(S sourceObject, D destinationObject, boolean mapNulls)
Maps the properties ofsourceObject
ontodestinationObject
.<S,D>
voidmap(S sourceObject, D destinationObject, java.lang.String fields)
Maps the properties ofsourceObject
ontodestinationObject
.<S,D>
voidmap(S sourceObject, D destinationObject, java.lang.String fields, boolean mapNulls)
Maps the properties ofsourceObject
ontodestinationObject
.<S,D>
Dmap(S sourceObject, java.lang.Class<D> destinationClass)
Create and return a new instance of type D mapped with the properties ofsourceObject
.<S,D>
Dmap(S sourceObject, java.lang.Class<D> destinationClass, java.lang.String fields)
Create and return a new instance of type D mapped with the specifiedfields
ofsourceObject
.<S,D>
Dmap(S sourceObject, java.lang.Class<D> destinationClass, java.util.Set<java.lang.String> fields)
Create and return a new instance of type D mapped with the specifiedfields
ofsourceObject
.<S,D>
voidmapAsCollection(java.lang.Iterable<S> source, java.util.Collection<D> destination, java.lang.Class<D> destinationClass, java.lang.String fields)
Map an iterable onto an existing collection<S,D>
java.util.List<D>mapAsList(java.lang.Iterable<S> source, java.lang.Class<D> destinationClass, java.lang.String fields)
Maps the source Iterable into a new List parameterized bydestinationClass
.<S,D>
java.util.Set<D>mapAsSet(java.lang.Iterable<S> source, java.lang.Class<D> destinationClass, java.lang.String fields)
Maps the source iterable into a new Set parameterized bydestinationClass
.<S,D>
voidmapGeneric(S sourceObject, D destObject, java.lang.reflect.Type[] sourceActualTypeArguments, java.lang.reflect.Type[] destActualTypeArguments, java.lang.String fields, java.util.Map<java.lang.String,java.lang.Class> destTypeVariableMap)
Maps the properties ofsourceObject
ontodestinationObject
, usingsourceActualTypeArguments
anddestActualTypeArguments
to specify the arguments of parameterized types of the source and destination object.
-
-
-
Field Detail
-
FIELD_SET_NAME
static final java.lang.String FIELD_SET_NAME
Field set name used in mapping context- See Also:
- Constant Field Values
-
MAP_NULLS
static final java.lang.String MAP_NULLS
Flag used in mapping context. Decides whether nulls are mapped or ignored.- See Also:
- Constant Field Values
-
FIELD_PREFIX
static final java.lang.String FIELD_PREFIX
Field prefix added to destination object field name- See Also:
- Constant Field Values
-
-
Method Detail
-
map
<S,D> D map(S sourceObject, java.lang.Class<D> destinationClass)
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
<S,D> D map(S sourceObject, java.lang.Class<D> destinationClass, java.lang.String fields)
Create and return a new instance of type D mapped with the specifiedfields
ofsourceObject
.- 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
fields
ofsourceObject
-
map
<S,D> D map(S sourceObject, java.lang.Class<D> destinationClass, java.util.Set<java.lang.String> fields)
Create and return a new instance of type D mapped with the specifiedfields
ofsourceObject
.- 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
fields
ofsourceObject
-
map
<S,D> void map(S sourceObject, D destinationObject)
Maps the properties ofsourceObject
ontodestinationObject
.- 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 ofsourceObject
ontodestinationObject
.- 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
<S,D> void map(S sourceObject, D destinationObject, java.lang.String fields)
Maps the properties ofsourceObject
ontodestinationObject
.- 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
<S,D> void map(S sourceObject, D destinationObject, java.lang.String fields, boolean mapNulls)
Maps the properties ofsourceObject
ontodestinationObject
.- 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
<S,D> java.util.Set<D> mapAsSet(java.lang.Iterable<S> source, java.lang.Class<D> destinationClass, java.lang.String fields)
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
destinationClass
mapped from the elements ofsource
.
-
mapAsList
<S,D> java.util.List<D> mapAsList(java.lang.Iterable<S> source, java.lang.Class<D> destinationClass, java.lang.String fields)
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
destinationClass
mapped from the elements ofsource
.
-
mapAsCollection
<S,D> void mapAsCollection(java.lang.Iterable<S> source, java.util.Collection<D> destination, java.lang.Class<D> destinationClass, java.lang.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, java.lang.reflect.Type[] sourceActualTypeArguments, java.lang.reflect.Type[] destActualTypeArguments, java.lang.String fields, java.util.Map<java.lang.String,java.lang.Class> destTypeVariableMap)
Maps the properties ofsourceObject
ontodestinationObject
, usingsourceActualTypeArguments
anddestActualTypeArguments
to 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 ProductSearchPageDatawe should give {SearchStateData.class,ProductData.class} destActualTypeArguments
- arguments of dest type
e.g. if we have type class like ProductSearchPageDatawe 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 ProductSearchPageDatawe should give map like {STATE=SearchStateData.class, RESULT=ProductData.class}
-
-