MiniCartControllerComponent uses CartInSession to find an existing Cart and MyCartBeanFactory to create an empty Cart if no Cart exists for the session, yet.
CartInSession uses TruncatedMiniCartBeanFactory to create a truncated MiniCartBean when serializing a Cart into the session cookie.
The use of MiniCartBeanFactory to create an empty Cart and a TruncatedMiniCartBeanFactory to serialize a non-empty Cart confused me when I was looking for the cause of a bug and makes it harder to introduce a subtype of MiniCartBean. Using TruncatedMiniCartBeanFactory / CartInSession.createMiniCart(...) would require additional null checks in TruncatedMiniCartBeanFactory.
MiniCartControllerComponent
usesCartInSession
to find an existingCart
andMyCartBeanFactory
to create an emptyCart
if noCart
exists for the session, yet.CartInSession
usesTruncatedMiniCartBeanFactory
to create a truncatedMiniCartBean
when serializing aCart
into the session cookie.MiniCartBeanFactory
to create an emptyCart
and aTruncatedMiniCartBeanFactory
to serialize a non-emptyCart
confused me when I was looking for the cause of a bug and makes it harder to introduce a subtype ofMiniCartBean
. UsingTruncatedMiniCartBeanFactory
/CartInSession.createMiniCart(...)
would require additional null checks inTruncatedMiniCartBeanFactory
.