Class DefaultQuantityFactory<Q extends javax.measure.Quantity<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.3, $Date: 2018-11-02 $
    Author:
    Martin Desruisseaux, Werner Keil, Jean-Marie Dautelle, Otavio Santana
    • Method Detail

      • 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
      • 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>>
      • create

        public javax.measure.Quantity<Q> create​(Number value,
                                                javax.measure.Unit<Q> unit,
                                                javax.measure.Quantity.Scale sc)
        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>>