public class Quantity extends java.lang.Object implements java.io.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(java.math.BigDecimal value,
java.lang.String unitCode)
Instantiates a new quantity.
|
Quantity(java.math.BigDecimal value,
UnitOfMeasurement unit)
Instantiates a new quantity.
|
Quantity(int value,
java.lang.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.
|
java.lang.String |
getUnitCode()
Gets the unit code.
|
java.math.BigDecimal |
getValue()
Gets the value.
|
void |
setUnit(UnitOfMeasurement unit)
Sets the unit.
|
void |
setUnitCode(java.lang.String newUnitCode)
Sets the unit code.
|
Quantity |
setValue(java.math.BigDecimal value)
Sets the value.
|
public Quantity()
Instantiates a new quantity.
public Quantity(java.math.BigDecimal value, java.lang.String unitCode)
Instantiates a new quantity.
value
- the valueunitCode
- the unit codepublic Quantity(java.math.BigDecimal value, UnitOfMeasurement unit)
Instantiates a new quantity.
value
- the valueunit
- the unitpublic Quantity(int value, java.lang.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 java.lang.String getUnitCode()
Gets the unit code.
@NotNull public java.math.BigDecimal getValue()
Gets the value.
public void setUnit(UnitOfMeasurement unit)
Sets the unit.
unit
- the new unitpublic void setUnitCode(java.lang.String newUnitCode)
Sets the unit code.
newUnitCode
- the new unit codeCopyright © 2014-2018 Konik.io. All Rights Reserved.