Class MergeItemPair<I>
java.lang.Object
com.broadleafcommerce.cartoperation.domain.MergeItemPair<I>
A matched pair of items. This typically indicates that the two contained items represent the same
actual item (e.g. a large, blue T-shirt SKU). Additional attributes describe what actions need to
occur for the merge of these two items to take place.
- Author:
- Jacob Mitash
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionThe matched item instance coming from the container.The type of merge for this item pair.The matched item instance that was modified (added or updated) and resulted in a merge needing to occur.boolean
Tells if the container instance (containerItem
) will need to be saved in order for the merge performed to be persisted.boolean
Tells if the modified instance (modifiedItem
) will need to be saved in order for the merge performed to be persisted.void
setMergeType
(String mergeType) The type of merge for this item pair.void
setNeedSaveContainerItem
(boolean needSaveContainerItem) Tells if the container instance (containerItem
) will need to be saved in order for the merge performed to be persisted.void
setNeedSaveModifiedItem
(boolean needSaveModifiedItem) Tells if the modified instance (modifiedItem
) will need to be saved in order for the merge performed to be persisted.
-
Constructor Details
-
MergeItemPair
-
-
Method Details
-
getContainerItem
The matched item instance coming from the container. For example, in a typical add to cart scenario, this would be the item already added to the cart for when another instance is being added (themodifiedItem
). Specifically, there might be a large, blue T-shirt in the cart, and the user adds another one. This field would be the former.- Returns:
- the matched item instance coming from the container
- See Also:
-
modifiedItem
-
getModifiedItem
The matched item instance that was modified (added or updated) and resulted in a merge needing to occur. For example, in a typical add to cart scenario, this would be the item in the process of being added to the cart for which there is already an instance in the cart (thecontainerItem
). Specifically, there might be a large, blue T-shirt in the cart, and the user adds another one. This field would be the latter.- Returns:
- the matched item instance that was modified and resulted in a merge needing to occur
-
getMergeType
The type of merge for this item pair. This will typically be one of theDefaultMergingType
values. This merge type may be determined by an application default (properties) or a product-level configuration.- Returns:
- the type of merge that will be used for this item pair
-
isNeedSaveContainerItem
public boolean isNeedSaveContainerItem()Tells if the container instance (containerItem
) will need to be saved in order for the merge performed to be persisted.- Returns:
- whether the container instance needs to be saved
-
isNeedSaveModifiedItem
public boolean isNeedSaveModifiedItem()Tells if the modified instance (modifiedItem
) will need to be saved in order for the merge performed to be persisted.- Returns:
- whether the modified instance needs to be saved
-
setMergeType
The type of merge for this item pair. This will typically be one of theDefaultMergingType
values. This merge type may be determined by an application default (properties) or a product-level configuration.- Parameters:
mergeType
- the type of merge that will be used for this item pair
-
setNeedSaveContainerItem
public void setNeedSaveContainerItem(boolean needSaveContainerItem) Tells if the container instance (containerItem
) will need to be saved in order for the merge performed to be persisted.- Parameters:
needSaveContainerItem
- whether the container instance needs to be saved
-
setNeedSaveModifiedItem
public void setNeedSaveModifiedItem(boolean needSaveModifiedItem) Tells if the modified instance (modifiedItem
) will need to be saved in order for the merge performed to be persisted.- Parameters:
needSaveModifiedItem
- whether the modified instance needs to be saved
-