@KwrkImmutable(knownImmutableClasses: [Quantity]) @CompileStatic class Commodity extends Object implements PostMapConstructorCheckable
The commodity of a cargo.
Type | Name and description |
---|---|
CommodityType |
commodityType Type of commodity. |
Quantity<Temperature> |
requestedStorageTemperature Requested storage temperature for a commodity. |
Quantity<Mass> |
weight The weight of commodity. |
Constructor and description |
---|
Commodity() |
Type Params | Return Type | Name and description |
---|---|---|
|
static Commodity |
make(CommodityType commodityType, Quantity<Mass> weight) |
|
static Commodity |
make(CommodityType commodityType, Quantity<Mass> weight, Quantity<Temperature> requestedStorageTemperature) The main factory method for creating Commodity instance (all other make() factory methods delegate to this one).
|
|
static Commodity |
make(CommodityType commodityType, Long weightInKilograms) |
|
static Commodity |
make(CommodityType commodityType, Long weightInKilograms, Integer requestedStorageTemperatureDegC) |
|
void |
postMapConstructorCheck(Map<String, ?> constructorArguments) |
Type of commodity.
Must not benull
.
Requested storage temperature for a commodity.
Whether it is necessary depends on the commodity type. If commodity type supports storage temperature,requestedStorageTemperature
must be inside of temperature range boundaries of the
corresponding commodity type.
When using factory make()
methods, if not provided, the requested storage temperature is populated from the recommended storage temperature of the corresponding commodity type that
supports storage temperature.
Map constructor will throw an DomainException
when requestedStorageTemperature
is non-null and commodityType
does not support storage temperature
(commodityType.containerFeaturesType.isContainerTemperatureControlled()
returns false
).
The weight of commodity.
This weight might exceed what a single container can carry (in that case, multiple containers will be allocated based on this commodity). Must not benull
, and must be at least 1 kg or greater. It must be specified in kilogram units and a value must be the whole number.
For conversion from other Mass
units, and for a conversion of decimal numbers, use make()
factory methods.
The main factory method for creating Commodity
instance (all other make()
factory methods delegate to this one).
null
) is requestedStorageTemperature
. When null
, the actual {code requestedStorageTemperature} of the instance is set to
the recommendedStorageTemperature
of provided commodityType
. Note that the recommendedStorageTemperature
of commodityType
can be null
.
Groovy Documentation