Class AefLabelMapper<M,​T extends ItemViewModel>

    • Constructor Detail

      • AefLabelMapper

        public AefLabelMapper​(ILabelProvider labelProvider)
        Creates a new mapper.
        Parameters:
        labelProvider - the label provider for mapping labels of domain model object to view model, cannot be null
      • AefLabelMapper

        public AefLabelMapper​(ILabelProvider labelProvider,
                              boolean needDecorate)
        Creates a new mapper.
        Parameters:
        labelProvider - the label provider for mapping labels of domain model object to view model, cannot be null
        needDecorate - true if need to wrapp ILabelProvider to DecoratingLabelProvider, false otherwise
    • Method Detail

      • mapModelToView

        public T mapModelToView​(M modelValue)
        Description copied from interface: IMapper
        Maps the model value to some projected view value.
        Specified by:
        mapModelToView in interface IMapper<M,​T extends ItemViewModel>
        Parameters:
        modelValue - the model value to map.
        Returns:
        mapped value.
      • mapViewToModel

        public M mapViewToModel​(T viewValue)
        Description copied from interface: IMapper
        Maps the view value to associated model value.
        Specified by:
        mapViewToModel in interface IMapper<M,​T extends ItemViewModel>
        Parameters:
        viewValue - the view value to map.
        Returns:
        mapped value.
      • updateItemViewModel

        public void updateItemViewModel​(T item,
                                        M modelValue)
        Description copied from interface: IViewModelsMapper
        Updates item view model.
        Specified by:
        updateItemViewModel in interface IViewModelsMapper<M,​T extends ItemViewModel>
        Parameters:
        item - the item view model, cannot be null
        modelValue - modelValue the model value, cannot be null
      • createMapKey

        protected Object createMapKey​(M modelValue)
        Creates a map key object. Override to implement specific mappings.
        Parameters:
        modelValue - the model value, cannot be null
        Returns:
        the key for 'modelValue-to-viewValue' map, cannot be null
      • createModelToView

        protected T createModelToView​(M modelValue)
        Creates and updates a view model item.
        Parameters:
        modelValue - the model value, cannot be null
        Returns:
        the newly created view model, cannot be null
      • createItemViewModel

        protected T createItemViewModel()
        Creates a view model item.
        Parameters:
        modelValue - the model value, cannot be null
        Returns:
        the newly created view model, cannot be null