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 Detail

      • bigDecimalValue

        BigDecimal bigDecimalValue()
        The numerical value of the quantity, as a BigDecimal.
        Returns:
        The value of the quantity.
      • bigIntegerValue

        BigInteger bigIntegerValue()
        The numerical value of the quantity, as a BigInteger.
        Returns:
        The value of the quantity.
      • convertTo

        Quantity<Unit> convertTo​(Unit unit)
        Convert this quantity to the given unit.
        Parameters:
        unit - The unit to convert to.
        Returns:
        The converted quantity.
      • doubleValue

        double doubleValue()
        The numerical value of the quantity, as a Double.
        Returns:
        The value of the quantity.
      • floatValue

        float floatValue()
        The numerical value of the quantity, as a Float.
        Returns:
        The value of the quantity.
      • intValue

        int intValue()
        The numerical value of the quantity, as an Integer.
        Returns:
        The value of the quantity.
      • longValue

        long longValue()
        The numerical value of the quantity, as a Long.
        Returns:
        The value of the quantity.
      • unit

        Unit unit()
        The unit of the quantity.
        Returns:
        The unit of the quantity.
      • value

        Number value()
        The numerical value of the quantity.
        Returns:
        The value of the quantity.