Interface Quantity<Unit extends MeasurementUnit<Unit>>
- All Superinterfaces:
Comparable<Quantity<Unit>>, Serializable
- All Known Implementing Classes:
QuantityBigDecimal, QuantityDouble
public interface Quantity<Unit extends MeasurementUnit<Unit>>
extends Comparable<Quantity<Unit>>, Serializable
A quantity with a numerical value with a
MeasurementUnit.
Quantity or amount is a property that can exist as a multitude or magnitude, which illustrate discontinuity and continuity. Quantities can be compared in terms of "more", "less", or "equal", or by assigning a numerical value multiple of a unit of measurement. Mass, time, distance, heat, and angle are among the familiar examples of quantitative properties.
- Since:
- 8.4.0
-
Method Summary
Modifier and TypeMethodDescriptionThe numerical value of the quantity, as aBigDecimal.The numerical value of the quantity, as aBigInteger.Convert this quantity to the given unit.doubleThe numerical value of the quantity, as aDouble.floatThe numerical value of the quantity, as aFloat.intintValue()The numerical value of the quantity, as anInteger.longThe numerical value of the quantity, as aLong.unit()The unit of the quantity.value()The numerical value of the quantity.Methods inherited from interface Comparable
compareTo
-
Method Details
-
bigDecimalValue
BigDecimal bigDecimalValue()The numerical value of the quantity, as aBigDecimal.- Returns:
- The value of the quantity.
-
bigIntegerValue
BigInteger bigIntegerValue()The numerical value of the quantity, as aBigInteger.- Returns:
- The value of the quantity.
-
convertTo
-
doubleValue
double doubleValue()The numerical value of the quantity, as aDouble.- Returns:
- The value of the quantity.
-
floatValue
float floatValue()The numerical value of the quantity, as aFloat.- Returns:
- The value of the quantity.
-
intValue
int intValue()The numerical value of the quantity, as anInteger.- Returns:
- The value of the quantity.
-
longValue
long longValue()The numerical value of the quantity, as aLong.- Returns:
- The value of the quantity.
-
unit
-
value
-