Class AbstractItem2MapPopulator<V>

    • Constructor Detail

      • AbstractItem2MapPopulator

        public AbstractItem2MapPopulator()
    • Method Detail

      • populate

        public void populate​(ItemToMapConversionContext source,
                             java.util.Map<java.lang.String,​java.lang.Object> target)
        Description copied from interface: Populator
        Populate the target instance with values from the source instance.
        Specified by:
        populate in interface Populator<ItemToMapConversionContext,​java.util.Map<java.lang.String,​java.lang.Object>>
        Parameters:
        source - the source object
        target - the target to fill
      • getAttributeValue

        protected V getAttributeValue​(ItemModel item,
                                      TypeAttributeDescriptor attribute)
        Reads attribute value from the data item in the provided data item.
        Parameters:
        item - a data item to read attribute value from.
        attribute - descriptor for attribute, whose value must me read
        Returns:
        value of the specified attribute in the context item or null, if the item does not have the specified attribute or the attribute was not set.
        See Also:
        ItemToMapConversionContext.getItemModel()
      • populateToMap

        protected abstract void populateToMap​(TypeAttributeDescriptor attr,
                                              ItemToMapConversionContext source,
                                              java.util.Map<java.lang.String,​java.lang.Object> target)
        Implements the logic to populate the target
        Parameters:
        attr - descriptor of the attribute to be populated
        source - Source used in the implementation to populate the target
        target - Populate the target with the result
      • isApplicable

        protected abstract boolean isApplicable​(TypeAttributeDescriptor attributeDescriptor)
        Indicates whether this Populator is applicable to process the attribute
        Parameters:
        attributeDescriptor - descriptor of the attribute to make the decision about
        Returns:
        true, if the Populator is applicable; otherwise false
      • getModelService

        protected ModelService getModelService()
        Gets a reference to the ModelService
        Returns:
        The ModelService
      • setModelService

        public void setModelService​(ModelService modelService)