public class Quantity extends Object implements Serializable
Defined by the amount and Unit
Units are based on Recommendation N°. 20 - Codes for Units of Measure Used in International Trade
| Constructor and Description |
|---|
Quantity()
Instantiates a new quantity.
|
Quantity(BigDecimal value,
String unitCode)
Instantiates a new quantity.
|
Quantity(BigDecimal value,
UnitOfMeasurement unit)
Instantiates a new quantity.
|
Quantity(int value,
String unitCode)
Instantiates a new quantity.
|
Quantity(int value,
UnitOfMeasurement unit)
Instantiates a new quantity.
|
| Modifier and Type | Method and Description |
|---|---|
UnitOfMeasurement |
getUnit()
Gets the unit.
|
String |
getUnitCode()
Gets the unit code.
|
BigDecimal |
getValue()
Gets the value.
|
void |
setUnit(UnitOfMeasurement unit)
Sets the unit.
|
void |
setUnitCode(String newUnitCode)
Sets the unit code.
|
Quantity |
setValue(BigDecimal value)
Sets the value.
|
public Quantity()
Instantiates a new quantity.
public Quantity(BigDecimal value, String unitCode)
Instantiates a new quantity.
value - the valueunitCode - the unit codepublic Quantity(BigDecimal value, UnitOfMeasurement unit)
Instantiates a new quantity.
value - the valueunit - the unitpublic Quantity(int value, String unitCode)
Instantiates a new quantity.
value - the valueunitCode - the unit codepublic Quantity(int value, UnitOfMeasurement unit)
Instantiates a new quantity.
value - the integer valueunit - the unitpublic UnitOfMeasurement getUnit()
Gets the unit.
@Size(min=1,
max=3)
public String getUnitCode()
Gets the unit code.
@NotNull public BigDecimal getValue()
Gets the value.
public void setUnit(UnitOfMeasurement unit)
Sets the unit.
unit - the new unitpublic void setUnitCode(String newUnitCode)
Sets the unit code.
newUnitCode - the new unit codepublic Quantity setValue(BigDecimal value)
Sets the value.
value - the new valueCopyright © 2014-2016 Konik.io. All Rights Reserved.