Class AbstractItem2MapPopulator<V>
- java.lang.Object
-
- de.hybris.platform.integrationservices.populator.AbstractItem2MapPopulator<V>
-
- All Implemented Interfaces:
Populator<ItemToMapConversionContext,java.util.Map<java.lang.String,java.lang.Object>>
- Direct Known Subclasses:
DefaultAtomicType2MapPopulator,DefaultCollectionType2MapPopulator,DefaultComposedType2MapPopulator,DefaultEnumerationMetaType2MapPopulator,DefaultMapType2MapPopulator,LocalizedAttribute2MapPopulator
public abstract class AbstractItem2MapPopulator<V> extends java.lang.Object implements Populator<ItemToMapConversionContext,java.util.Map<java.lang.String,java.lang.Object>>
Abstract class to populate given item model to a Map which is representation of the Integration Object. V - type of the value handled by this populator
-
-
Constructor Summary
Constructors Constructor Description AbstractItem2MapPopulator()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected VgetAttributeValue(ItemModel item, TypeAttributeDescriptor attribute)Reads attribute value from the data item in the provided data item.protected VgetAttributeValue(ItemToMapConversionContext context, TypeAttributeDescriptor descriptor)Reads attribute value from the data item in the provided conversion context.protected ModelServicegetModelService()Gets a reference to theModelServiceprotected abstract booleanisApplicable(TypeAttributeDescriptor attributeDescriptor)Indicates whether this Populator is applicable to process the attributevoidpopulate(ItemToMapConversionContext source, java.util.Map<java.lang.String,java.lang.Object> target)Populate the target instance with values from the source instance.protected abstract voidpopulateToMap(TypeAttributeDescriptor attr, ItemToMapConversionContext source, java.util.Map<java.lang.String,java.lang.Object> target)Implements the logic to populate the targetvoidsetModelService(ModelService modelService)
-
-
-
Method Detail
-
populate
public void populate(ItemToMapConversionContext source, java.util.Map<java.lang.String,java.lang.Object> target)
Description copied from interface:PopulatorPopulate the target instance with values from the source instance.- Specified by:
populatein interfacePopulator<ItemToMapConversionContext,java.util.Map<java.lang.String,java.lang.Object>>- Parameters:
source- the source objecttarget- the target to fill
-
getAttributeValue
protected V getAttributeValue(ItemToMapConversionContext context, TypeAttributeDescriptor descriptor)
Reads attribute value from the data item in the provided conversion context. This implementation delegates togetAttributeValue(ItemModel, TypeAttributeDescriptor)- Parameters:
context- the conversion context holding a data item to read attribute value from.descriptor- 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()
-
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 populatedsource- Source used in the implementation to populate the targettarget- 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; otherwisefalse
-
getModelService
protected ModelService getModelService()
Gets a reference to theModelService- Returns:
- The ModelService
-
setModelService
public void setModelService(ModelService modelService)
-
-