Class AbstractDataToWsConverter<DATA,WSDTO>
- java.lang.Object
-
- de.hybris.platform.cmsoccaddon.mapping.converters.AbstractDataToWsConverter<DATA,WSDTO>
-
- Type Parameters:
DATA- the source object to convertWSDTO- the target object to populate
- All Implemented Interfaces:
DataToWsConverter<DATA,WSDTO>
- Direct Known Subclasses:
ComponentDataToWsConverter,MediaDataToWsConverter,NavigationNodeDataToWsConverter,PageDataToWsConverter,SlotDataToWsConverter
public abstract class AbstractDataToWsConverter<DATA,WSDTO> extends java.lang.Object implements DataToWsConverter<DATA,WSDTO>
The abstract implementation ofDataToWsConverterthat usesCMSDataMapperto convert data objects to ws objects.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.Stringfields
-
Constructor Summary
Constructors Constructor Description AbstractDataToWsConverter()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.function.Predicate<java.lang.Object>canConvert()Predicate to verify whether the convert method can be used or not.WSDTOconvert(DATA source, java.lang.String fields)Method to convert a source object to a target object.java.util.Collection<java.lang.Object>convertCollection(java.util.Collection<java.lang.Object> source)Converts collection that contains data objects to a collection that contains ws objects.java.util.Map<java.lang.String,java.lang.Object>convertMap(java.util.Map<java.lang.String,java.lang.Object> map)Convert a map that contains data objects to a map that contains ws objects.java.lang.ObjectconvertPrimitive(java.lang.Object source)Converts primitives from source to targetvoidcustomize(ma.glasnost.orika.MapperFactory factory)Method to customize conversion between source and target object.protected CMSDataMappergetMapper()protected static booleanisCollection(java.lang.Object valueObj)Method tests whether theObjectis aCollection.protected static booleanisMap(java.lang.Object valueObj)Method tests whether theObjectis aMap.voidsetMapper(CMSDataMapper mapper)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface de.hybris.platform.cmsoccaddon.mapping.converters.DataToWsConverter
getDataClass, getWsClass
-
-
-
-
Method Detail
-
canConvert
public java.util.function.Predicate<java.lang.Object> canConvert()
Description copied from interface:DataToWsConverterPredicate to verify whether the convert method can be used or not.- Specified by:
canConvertin interfaceDataToWsConverter<DATA,WSDTO>- Returns:
TRUEwhen {DataToWsConverter.convert(Object, String)can be performed;FALSEotherwise.
-
convert
public WSDTO convert(DATA source, java.lang.String fields)
Description copied from interface:DataToWsConverterMethod to convert a source object to a target object.- Specified by:
convertin interfaceDataToWsConverter<DATA,WSDTO>- Parameters:
source- the source objectfields- the fields that should be populated in target object- Returns:
- the target object
-
convertMap
public java.util.Map<java.lang.String,java.lang.Object> convertMap(java.util.Map<java.lang.String,java.lang.Object> map)
Convert a map that contains data objects to a map that contains ws objects.- Parameters:
map- the map that contains data objects- Returns:
- the map that contains ws objects.
-
convertPrimitive
public java.lang.Object convertPrimitive(java.lang.Object source)
Converts primitives from source to target- Parameters:
source- the source primitive- Returns:
- the target primitive
-
convertCollection
public java.util.Collection<java.lang.Object> convertCollection(java.util.Collection<java.lang.Object> source)
Converts collection that contains data objects to a collection that contains ws objects.- Parameters:
source- the collection that contains data objects- Returns:
- the collection that contains ws objects.
-
customize
public void customize(ma.glasnost.orika.MapperFactory factory)
Description copied from interface:DataToWsConverterMethod to customize conversion between source and target object. This method is called after the basic conversion is finished.- Specified by:
customizein interfaceDataToWsConverter<DATA,WSDTO>- Parameters:
factory- theMapperFactorythat can be used to add new customization.
-
isCollection
protected static boolean isCollection(java.lang.Object valueObj)
Method tests whether theObjectis aCollection.- Parameters:
valueObj- theObjectto test- Returns:
- true if the
Objectis aCollection, false otherwise.
-
isMap
protected static boolean isMap(java.lang.Object valueObj)
Method tests whether theObjectis aMap.- Parameters:
valueObj- theObjectto test- Returns:
- true if the
Objectis aMap, false otherwise.
-
getMapper
protected CMSDataMapper getMapper()
-
setMapper
public void setMapper(CMSDataMapper mapper)
-
-