Class TestQuantities

Object
TestQuantities

public final class TestQuantities extends Object
Singleton class for accessing Quantity instances.
Since:
1.0
Author:
werner, otaviojava
  • Method Details

    • getQuantity

      public static <Q extends Quantity<Q>> Quantity<Q> getQuantity(Number value, Unit<Q> unit)
      Returns the scalar measurement. When the Number was BigDecimal or BigInteger will use DecimalQuantity, when the Number was Double will DoubleQuantity otherwise NumberQuantity. in the specified unit.
      Type Parameters:
      Q - The type of the quantity.
      Parameters:
      value - the measurement value.
      unit - the measurement unit.
      Returns:
      the corresponding numeric measurement.
      Throws:
      NullPointerException - when value or unit were null