Q
- The type of the quantity.public abstract class ProxyQuantityFactory<Q extends javax.measure.Quantity<Q>>
extends java.lang.Object
implements javax.measure.spi.QuantityFactory<Q>
Number
/Unit
).
For example:
Quantity m = ProxyQuantityFactory.getInstance(Mass.class).create(23.0, KILOGRAM); // 23.0 kg
Quantity
Modifier and Type | Class and Description |
---|---|
private static class |
ProxyQuantityFactory.Default<Q extends javax.measure.Quantity<Q>>
The default factory implementation.
|
private static class |
ProxyQuantityFactory.GenericHandler<Q extends javax.measure.Quantity<Q>>
The method invocation handler for implementation backed by any kind of
Number . |
Modifier and Type | Field and Description |
---|---|
private static java.util.Map<java.lang.Class,ProxyQuantityFactory> |
INSTANCES
Holds the current instances.
|
private static java.util.logging.Level |
LOG_LEVEL |
private static java.util.logging.Logger |
logger |
Constructor and Description |
---|
ProxyQuantityFactory() |
Modifier and Type | Method and Description |
---|---|
static <Q extends javax.measure.Quantity<Q>> |
getInstance(java.lang.Class<Q> type)
Returns the default instance for the specified quantity type.
|
abstract javax.measure.Unit<Q> |
getSystemUnit()
Returns the metric unit for quantities produced by this factory or
null if unknown. |
protected static <Q extends javax.measure.Quantity<Q>> |
setInstance(java.lang.Class<Q> type,
ProxyQuantityFactory<Q> factory)
Overrides the default implementation of the factory for the specified quantity type.
|
private static final java.util.Map<java.lang.Class,ProxyQuantityFactory> INSTANCES
private static final java.util.logging.Logger logger
private static final java.util.logging.Level LOG_LEVEL
public static <Q extends javax.measure.Quantity<Q>> ProxyQuantityFactory<Q> getInstance(java.lang.Class<Q> type)
Q
- The type of the quantitytype
- the quantity typeprotected static <Q extends javax.measure.Quantity<Q>> void setInstance(java.lang.Class<Q> type, ProxyQuantityFactory<Q> factory)
Q
- The type of the quantitytype
- the quantity typefactory
- the quantity factorypublic abstract javax.measure.Unit<Q> getSystemUnit()
null
if unknown.