Class ConverterModelDataMapper

  • All Implemented Interfaces:
    ModelDataMapper

    public class ConverterModelDataMapper
    extends java.lang.Object
    implements ModelDataMapper
    Mapper using converters to map platform model into DTO. If no converter is found, then simple reflection is used - a setter method is searched for each property sent through socket.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected ConverterRegistry getConverterRegistry()  
      <S,​T>
      java.lang.Class<S>
      getSourceType​(com.hybris.cockpitng.engine.WidgetInstanceManager widgetInstanceManager, java.lang.Class<? extends T> targetClass)
      Looks for source class for provided target type.
      <S,​T>
      T
      map​(com.hybris.cockpitng.engine.WidgetInstanceManager widgetInstanceManager, S model)
      Maps provided object into its proper representation (DTO into platform model or another way round)
      <T> void map​(com.hybris.cockpitng.engine.WidgetInstanceManager widgetInstanceManager, T target, java.util.Map<java.lang.String,​java.lang.Object> values)
      Maps provided values with proper fields in provided target object
      void setConverterRegistry​(ConverterRegistry converterRegistry)  
      void setTypeFacade​(com.hybris.cockpitng.dataaccess.facades.type.TypeFacade typeFacade)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ConverterModelDataMapper

        public ConverterModelDataMapper()
    • Method Detail

      • map

        public <T> void map​(com.hybris.cockpitng.engine.WidgetInstanceManager widgetInstanceManager,
                            T target,
                            java.util.Map<java.lang.String,​java.lang.Object> values)
        Description copied from interface: ModelDataMapper
        Maps provided values with proper fields in provided target object
        Specified by:
        map in interface ModelDataMapper
        Type Parameters:
        T - type of target model
        Parameters:
        widgetInstanceManager - widget instance manager for widget that requested mapping
        target - target object, which fields should be mapped
        values - values to map
      • map

        public <S,​T> T map​(com.hybris.cockpitng.engine.WidgetInstanceManager widgetInstanceManager,
                                 S model)
        Description copied from interface: ModelDataMapper
        Maps provided object into its proper representation (DTO into platform model or another way round)
        Specified by:
        map in interface ModelDataMapper
        Type Parameters:
        S - type of source object
        T - type of target object
        Parameters:
        widgetInstanceManager - widget instance manager for widget that requested mapping
        model - object to be mapped
        Returns:
        object with mapped values
      • getSourceType

        public <S,​T> java.lang.Class<S> getSourceType​(com.hybris.cockpitng.engine.WidgetInstanceManager widgetInstanceManager,
                                                            java.lang.Class<? extends T> targetClass)
        Description copied from interface: ModelDataMapper
        Looks for source class for provided target type.
        Specified by:
        getSourceType in interface ModelDataMapper
        Type Parameters:
        S - type of source object
        T - type of target source
        Parameters:
        widgetInstanceManager - widget instance manager for widget that requested mapping
        targetClass - mapping target class
        Returns:
        class that would be mapped into provided target class or null, if mapper is unable to map anything into provided tagert class
      • setConverterRegistry

        public void setConverterRegistry​(ConverterRegistry converterRegistry)
      • setTypeFacade

        public void setTypeFacade​(com.hybris.cockpitng.dataaccess.facades.type.TypeFacade typeFacade)