Class DefaultDataMapper
java.lang.Object
ma.glasnost.orika.impl.ConfigurableMapper
de.hybris.platform.webservicescommons.mapping.impl.DefaultDataMapper
- All Implemented Interfaces:
DataMapper,ma.glasnost.orika.MapperFacade,org.springframework.beans.factory.Aware,org.springframework.context.ApplicationContextAware
- Direct Known Subclasses:
DefaultCMSDataMapper,DefaultCMSDataMapper
public class DefaultDataMapper
extends ma.glasnost.orika.impl.ConfigurableMapper
implements DataMapper, org.springframework.context.ApplicationContextAware
Implementation of
It automatically discovers and registers managed beans of type
DataMapper used for mapping commercefacade's
Data objects into WsDTOs. It automatically discovers and registers managed beans of type
Mapper,
Converter or Filter annotated with
WsDTOMapping.-
Field Summary
Fields inherited from interface de.hybris.platform.webservicescommons.mapping.DataMapper
FIELD_PREFIX, FIELD_SET_NAME, MAP_NULLS -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidvoidaddConverter(ma.glasnost.orika.Converter<?, ?> converter) Registers aConverter.voidaddFieldMapper(FieldMapper fieldMapper) Registers aClassMapwith field mapping given by fieldMapper objectvoidaddFilter(ma.glasnost.orika.Filter<?, ?> filter) Registers aFilter.voidaddMapper(ma.glasnost.orika.Mapper<?, ?> mapper) Registers aMapper.protected voidconfigure(ma.glasnost.orika.MapperFactory factory) protected voidconfigureFactoryBuilder(ma.glasnost.orika.impl.DefaultMapperFactory.Builder factoryBuilder) protected ma.glasnost.orika.MappingContextcreateMappingContext(Class destinationClass, String fields) protected ma.glasnost.orika.MappingContextcreateMappingContext(Class destinationClass, String fields, boolean mapNulls) protected ma.glasnost.orika.MappingContextcreateMappingContext(Set<String> fields) protected ma.glasnost.orika.MappingContextcreateMappingContextForGeneric(Class destinationClass, String fields, Map<String, Class> typeVariableMap) protected Collection<Object>Finds all beans with annotation WsDTOMapping in current context and in parent contexts<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 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.protected voidregisterObjectFactory(TypeObjectFactory<Object> objectFactory) voidsetApplicationContext(org.springframework.context.ApplicationContext applicationContext) voidsetFieldSetBuilder(FieldSetBuilder fieldSetBuilder) Methods inherited from class ma.glasnost.orika.impl.ConfigurableMapper
convert, convert, dedicatedMapperFor, dedicatedMapperFor, dedicatedMapperFor, dedicatedMapperFor, factoryModified, init, map, map, map, map, map, map, map, map, mapAsArray, mapAsArray, mapAsArray, mapAsArray, mapAsArray, mapAsArray, mapAsArray, mapAsArray, mapAsArray, mapAsArray, mapAsCollection, mapAsCollection, mapAsCollection, mapAsCollection, mapAsCollection, mapAsCollection, mapAsCollection, mapAsCollection, mapAsList, mapAsList, mapAsList, mapAsList, mapAsList, mapAsList, mapAsList, mapAsList, mapAsList, mapAsList, mapAsMap, mapAsMap, mapAsMap, mapAsMap, mapAsMap, mapAsMap, mapAsSet, mapAsSet, mapAsSet, mapAsSet, mapAsSet, mapAsSet, mapAsSet, mapAsSet, mapAsSet, mapAsSet, newObject, resolveMappingStrategyMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface de.hybris.platform.webservicescommons.mapping.DataMapper
map, map
-
Constructor Details
-
DefaultDataMapper
public DefaultDataMapper()
-
-
Method Details
-
configureFactoryBuilder
protected void configureFactoryBuilder(ma.glasnost.orika.impl.DefaultMapperFactory.Builder factoryBuilder) - Overrides:
configureFactoryBuilderin classma.glasnost.orika.impl.ConfigurableMapper
-
configure
protected void configure(ma.glasnost.orika.MapperFactory factory) - Overrides:
configurein classma.glasnost.orika.impl.ConfigurableMapper
-
setApplicationContext
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) - Specified by:
setApplicationContextin interfaceorg.springframework.context.ApplicationContextAware
-
addAllSpringBeans
protected void addAllSpringBeans() -
getBeansForConfiguration
Finds all beans with annotation WsDTOMapping in current context and in parent contexts- Returns:
- Collection of all beans with WsDTOMapping annotation
-
registerObjectFactory
-
addConverter
public void addConverter(ma.glasnost.orika.Converter<?, ?> converter) Registers aConverter.- Parameters:
converter- The converter.
-
addMapper
public void addMapper(ma.glasnost.orika.Mapper<?, ?> mapper) Registers aMapper.- Parameters:
mapper- The mapper.
-
addFilter
public void addFilter(ma.glasnost.orika.Filter<?, ?> filter) Registers aFilter.- Parameters:
filter- The filter.
-
addFieldMapper
Registers aClassMapwith field mapping given by fieldMapper object- Parameters:
fieldMapper- Object storing field mapping information.
-
map
Description copied from interface:DataMapperCreate and return a new instance of type D mapped with the specifiedfieldsofsourceObject.- Specified by:
mapin interfaceDataMapper- 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
Description copied from interface:DataMapperCreate and return a new instance of type D mapped with the specifiedfieldsofsourceObject.- Specified by:
mapin interfaceDataMapper- 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
Description copied from interface:DataMapperMaps the properties ofsourceObjectontodestinationObject.- Specified by:
mapin interfaceDataMapper- 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
Description copied from interface:DataMapperMaps the properties ofsourceObjectontodestinationObject.- Specified by:
mapin interfaceDataMapper- 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
-
map
public <S,D> void map(S sourceObject, D destinationObject, boolean mapNulls) Description copied from interface:DataMapperMaps the properties ofsourceObjectontodestinationObject.- Specified by:
mapin interfaceDataMapper- 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
-
mapAsList
Description copied from interface:DataMapperMaps the source Iterable into a new List parameterized bydestinationClass.- Specified by:
mapAsListin interfaceDataMapper- 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.
-
mapAsSet
Description copied from interface:DataMapperMaps the source iterable into a new Set parameterized bydestinationClass.- Specified by:
mapAsSetin interfaceDataMapper- 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.
-
mapAsCollection
public <S,D> void mapAsCollection(Iterable<S> source, Collection<D> destination, Class<D> destinationClass, String fields) Description copied from interface:DataMapperMap an iterable onto an existing collection- Specified by:
mapAsCollectionin interfaceDataMapper- Parameters:
source- the source iterabledestination- the destination collectiondestinationClass- the type of elements in the destinationfields- comma-separated fields to map
-
mapGeneric
public <S,D> void mapGeneric(S sourceObject, D destObject, Type[] sourceActualTypeArguments, Type[] destActualTypeArguments, String fields, Map<String, Class> destTypeVariableMap) Description copied from interface:DataMapperMaps the properties ofsourceObjectontodestinationObject, usingsourceActualTypeArgumentsanddestActualTypeArgumentsto specify the arguments of parameterized types of the source and destination object.- Specified by:
mapGenericin interfaceDataMapper- 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}
-
createMappingContext
-
createMappingContext
-
createMappingContext
-
createMappingContextForGeneric
-
setFieldSetBuilder
-