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

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

public abstract class ProxyQuantityFactory<Q extends javax.measure.Quantity<Q>> extends Object implements javax.measure.spi.QuantityFactory<Q>
A factory producing simple quantities instances (tuples Number/Unit). This implementation of QuantityFactory uses the DynamicProxy features of Java reflection API.

For example:
Quantity m = ProxyQuantityFactory.getInstance(Mass.class).create(23.0, KILOGRAM); // 23.0 kg
Quantity
Since:
1.0
Version:
1.1, $Date: 2018-03-04 $
  • Field Details

    • INSTANCES

      private static final Map<Class,ProxyQuantityFactory> INSTANCES
      Holds the current instances.
    • logger

      private static final Logger logger
    • LOG_LEVEL

      private static final Level LOG_LEVEL
  • Constructor Details

    • ProxyQuantityFactory

      public ProxyQuantityFactory()
  • Method Details

    • getInstance

      public static <Q extends javax.measure.Quantity<Q>> ProxyQuantityFactory<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
    • setInstance

      protected static <Q extends javax.measure.Quantity<Q>> void setInstance(Class<Q> type, ProxyQuantityFactory<Q> factory)
      Overrides the default implementation of the factory for the specified quantity type.
      Type Parameters:
      Q - The type of the quantity
      Parameters:
      type - the quantity type
      factory - the quantity factory
    • getSystemUnit

      public abstract javax.measure.Unit<Q> getSystemUnit()
      Returns the metric unit for quantities produced by this factory or null if unknown.
      Specified by:
      getSystemUnit in interface javax.measure.spi.QuantityFactory<Q extends javax.measure.Quantity<Q>>
      Returns:
      the metric units for this factory quantities.