@KwrkImmutable @CompileStatic class CargoCommandData extends Object implements PostMapConstructorCheckable
Encapsulates cargo-related properties in CreteBookingOfferCommand.
It is interesting to note the reasons for using CargoCommandData class instead of just using the Cargo value object. The Cargo value object contains multiple calculated properties, which are populated in the aggregate with the help of additional services injected into the aggregate. If we use the Cargo value object instead of CargoCommandData, we will end up with a partial Cargo instance that has to be recreated when the command arrives in the aggregate. And this will work without any technical issues. However, to make an explicit distinction between cargo specification and complete cargo instance, we opted to use CargoCommandData. That way, we don't have to care about how to construct a Cargo instance and whether or not we should use some parameters. This is very useful for potential external users (i.e., projection app) of the command API. Regarding dependencies, CargoCommandData belongs to the command model (commands and aggregates) and can be referenced and used from wherever the command model is allowed to be used.Type | Name and description |
---|---|
Commodity |
commodity |
ContainerDimensionType |
containerDimensionType |
Constructor and description |
---|
CargoCommandData() |
Groovy Documentation