Class DefaultQuantityFactory<Q extends javax.measure.Quantity<Q>>

java.lang.Object
tech.units.indriya.quantity.DefaultQuantityFactory<Q>
Type Parameters:
Q - The type of the quantity.
All Implemented Interfaces:
javax.measure.spi.QuantityFactory<Q>

public class DefaultQuantityFactory<Q extends javax.measure.Quantity<Q>> extends Object implements javax.measure.spi.QuantityFactory<Q>
A factory producing simple quantities instances (tuples Number/ Unit).
For example:
Mass m = DefaultQuantityFactory.getInstance(Mass.class).create(23.0, KILOGRAM); // 23.0 kg
Time m = DefaultQuantityFactory.getInstance(Time.class).create(124, MILLI(SECOND)); // 124 ms
Since:
1.0
Version:
1.1, $Date: 2018-03-04 $
Author:
Martin Desruisseaux, Werner Keil, Jean-Marie Dautelle, Otavio Santana
  • Method Details

    • getInstance

      public static <Q extends javax.measure.Quantity<Q>> javax.measure.spi.QuantityFactory<Q> getInstance(Class<Q> type)
      Returns the default instance for the specified quantity type.
      Type Parameters:
      Q - The type of the quantity
      Parameters:
      type - the quantity type
      Returns:
      the quantity factory for the specified type
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • create

      public javax.measure.Quantity<Q> create(Number value, javax.measure.Unit<Q> unit)
      Specified by:
      create in interface javax.measure.spi.QuantityFactory<Q extends javax.measure.Quantity<Q>>
    • getSystemUnit

      public javax.measure.Unit<Q> getSystemUnit()
      Specified by:
      getSystemUnit in interface javax.measure.spi.QuantityFactory<Q extends javax.measure.Quantity<Q>>