Class ItemToMapConversionContext
Map-
Constructor Summary
ConstructorsConstructorDescriptionItemToMapConversionContext(ItemModel data, TypeDescriptor metadata) Deprecated, for removal: This API element is subject to removal in a future version.ItemToMapConversionContext(Object payloadObject, TypeDescriptor metadata) Instantiates a top level context. -
Method Summary
Modifier and TypeMethodDescriptioncreateSubContext(ItemModel itemModel, TypeDescriptor descriptor) Deprecated, for removal: This API element is subject to removal in a future version.usecreateSubContext(Object, TypeDescriptor)insteadcreateSubContext(Object payloadObject, TypeDescriptor descriptor) Creates sub-context from this context.Retrieves a conversion result for the item in this context.Deprecated, for removal: This API element is subject to removal in a future version.protected ItemToMapConversionContextRetrieves parent context.This will return the payload object according to the integration object specs.Retrieves the integration object item descriptor associated with the conversion.voidsetConversionResult(Map<String, Object> result) Sets conversion result for the item in this context.toString()
-
Constructor Details
-
ItemToMapConversionContext
@Deprecated(since="2211.FP1", forRemoval=true) public ItemToMapConversionContext(ItemModel data, TypeDescriptor metadata) Deprecated, for removal: This API element is subject to removal in a future version.use#ItemToMapConversionContext(final Object payloadObject, final TypeDescriptor metadata)Instantiates a top level context. The top level context does not have parent context associated with it.- Parameters:
data- item being converted.metadata- integration object item descriptor defining the structure of the conversion result, e.g. if thedatais being converted to aMap, then what attributes the map should have.- See Also:
-
ItemToMapConversionContext
Instantiates a top level context. The top level context does not have parent context associated with it.- Parameters:
payloadObject- payload object being converted. It can beItemModelor any POJO.metadata- integration object item descriptor defining the structure of the conversion result, e.g. if thedatais being converted to aMap, then what attributes the map should have.- See Also:
-
-
Method Details
-
getItemModel
Deprecated, for removal: This API element is subject to removal in a future version.Retrieves the item being converted.- Returns:
- item being converted.
-
getPayloadObject
This will return the payload object according to the integration object specs. It can be traditionalItemModelor any POJO.- Returns:
- the payload object.
-
getTypeDescriptor
Retrieves the integration object item descriptor associated with the conversion.- Returns:
- metadata describing the structure of the conversion result.
-
getParentContext
Retrieves parent context.- Returns:
- conversion context from which this context was created or
null, if the context was created independently by the constructor. - See Also:
-
createSubContext
Creates sub-context from this context.- Parameters:
payloadObject- pojo to be used in the context to createdescriptor- integration object item descriptor to be used in the context to create- Returns:
- a new conversion context with current context as its parent.
-
createSubContext
@Deprecated(since="2211.FP1", forRemoval=true) public ItemToMapConversionContext createSubContext(ItemModel itemModel, TypeDescriptor descriptor) Deprecated, for removal: This API element is subject to removal in a future version.usecreateSubContext(Object, TypeDescriptor)insteadCreates sub-context from this context.- Parameters:
itemModel- data item to be used in the context to createdescriptor- integration object item descriptor to be used in the context to create- Returns:
- a new conversion context with current context as its parent
-
setConversionResult
Sets conversion result for the item in this context.- Parameters:
result- map, to which thegetItemModel()was converted.
-
getConversionResult
Retrieves a conversion result for the item in this context. Because this method is used to retrieve result of current item conversion in the parent contexts, so that it can be injected to a nested item, this method returns only a map containing only key attribute values of the previously converted item. Without limiting the conversion result to key attributes there is a risk of causing an infinite loop in the conversion result structure.Consider this. We need to convert an Order, which has code attribute (its key) and a collection of OrderEntry items. Each OrderEntry has a reference back to the Order it belongs to, some entryNumber attribute, which makes the entry unique when combined with the Order, and some other meaningful attributes, e.g. Product the line is associated with, quantity (how many products purchased), etc. During conversion when we will get to OrderEntry conversion and will attempt to convert its
orderattribute value we will detect that the Order has been converted already into a map. However, if we just take that map "as is" it will contain theorderEntries, each OrderEntry refers to the Order again and thus an infinite loop is formed. For that reason, for OrderEntries we include Order map with key attribute values only, i.e.codeattribute.- Returns:
- a map containing key attribute values for the previous conversion result that was added to this context or to the
parent(s) of this context. If the specified item was not converted yet, then
nullis returned.
-
toString
-
#ItemToMapConversionContext(final Object payloadObject, final TypeDescriptor metadata)