Interface MeasurementUnit<Self extends MeasurementUnit<Self>>

  • All Known Subinterfaces:
    Length, Mass, Time
    All Known Implementing Classes:
    LengthUnit, MassUnit, TimeUnit

    public interface MeasurementUnit<Self extends MeasurementUnit<Self>>
    Represents a unit of measurement, such as length, weight, or time. Each unit has a reference unit from and to which it can be converted. The reference unit depends on the subtype, but is usually an SI unit.
    Since:
    8.4.0
    • Method Detail

      • conversionFactorDenominator

        long conversionFactorDenominator()
        The denominator of the fraction representing the conversion factor from this unit to the reference unit.
        Returns:
        The conversion factor denominator.
      • conversionFactorNumerator

        long conversionFactorNumerator()
        The numerator of the fraction representing the conversion factor from this unit to the reference unit.
        Returns:
        The conversion factor numerator.
      • of

        QuantityDouble<Self> of​(double value)
        Creates a new QuantityDouble that uses double object with the specified value in this unit.
        Parameters:
        value - The value in this unit.
        Returns:
        A new QuantityDouble object with the specified value in this unit.
      • symbol

        String symbol()
        The reference unit of this measurement unit. Also serves as a unique identifier for the unit.
        Returns:
        The unit symbol.
      • toString

        String toString()
        Gets a string representation of the unit, usually the unit symbol such as "m" for meters or "kg" for kilograms.
        Overrides:
        toString in class Object
        Returns:
        The reference unit.