Amount(tokenQuantity: Long, token: T)
Automatic conversion constructor from number of tokens to an Amount using getDisplayTokenSize to determine the displayTokenSize.
tokenQuantity - the number of tokens represented.
token - the type of the token, for example a Currency object.
Amount(quantity: Long, displayTokenSize: BigDecimal, token: T)
Amount represents a positive quantity of some token (currency, asset, etc.), measured in quantity of the smallest representable units. The nominal quantity represented by each individual token is equal to the displayTokenSize. The scale property of the displayTokenSize should correctly reflect the displayed decimal places and is used when rounding conversions from indicative/displayed amounts in BigDecimal to Amount occur via the Amount.fromDecimal method.
Amounts of different tokens do not mix and attempting to add or subtract two amounts of different currencies will throw IllegalArgumentException. Amounts may not be negative. Amounts are represented internally using a signed 64 bit value, therefore, the maximum expressable amount is 2^63 - 1 == Long.MAX_VALUE. Addition, subtraction and multiplication are overflow checked and will throw ArithmeticException if the operation would have caused integer overflow.