Class AbstractDataToWsConverter<DATA,WSDTO>

java.lang.Object
de.hybris.platform.cmsoccaddon.mapping.converters.AbstractDataToWsConverter<DATA,WSDTO>
Type Parameters:
DATA - the source object to convert
WSDTO - 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 Object implements DataToWsConverter<DATA,WSDTO>
The abstract implementation of DataToWsConverter that uses CMSDataMapper to convert data objects to ws objects.
  • Field Details

    • fields

      protected String fields
  • Constructor Details

    • AbstractDataToWsConverter

      public AbstractDataToWsConverter()
  • Method Details

    • canConvert

      public Predicate<Object> canConvert()
      Description copied from interface: DataToWsConverter
      Predicate to verify whether the convert method can be used or not.
      Specified by:
      canConvert in interface DataToWsConverter<DATA,WSDTO>
      Returns:
      TRUE when {DataToWsConverter.convert(Object, String) can be performed; FALSE otherwise.
    • convert

      public WSDTO convert(DATA source, String fields)
      Description copied from interface: DataToWsConverter
      Method to convert a source object to a target object.
      Specified by:
      convert in interface DataToWsConverter<DATA,WSDTO>
      Parameters:
      source - the source object
      fields - the fields that should be populated in target object
      Returns:
      the target object
    • convertMap

      public Map<String,Object> convertMap(Map<String,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 Object convertPrimitive(Object source)
      Converts primitives from source to target
      Parameters:
      source - the source primitive
      Returns:
      the target primitive
    • convertCollection

      public Collection<Object> convertCollection(Collection<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: DataToWsConverter
      Method to customize conversion between source and target object. This method is called after the basic conversion is finished.
      Specified by:
      customize in interface DataToWsConverter<DATA,WSDTO>
      Parameters:
      factory - the MapperFactory that can be used to add new customization.
    • isCollection

      protected static boolean isCollection(Object valueObj)
      Method tests whether the Object is a Collection.
      Parameters:
      valueObj - the Object to test
      Returns:
      true if the Object is a Collection, false otherwise.
    • isMap

      protected static boolean isMap(Object valueObj)
      Method tests whether the Object is a Map.
      Parameters:
      valueObj - the Object to test
      Returns:
      true if the Object is a Map, false otherwise.
    • getMapper

      protected CMSDataMapper getMapper()
    • setMapper

      public void setMapper(CMSDataMapper mapper)