Package tech.units.indriya.quantity
Class DefaultQuantityFactory<Q extends Quantity<Q>>
- java.lang.Object
-
- tech.units.indriya.quantity.DefaultQuantityFactory<Q>
-
- Type Parameters:
Q- The type of the quantity.
- All Implemented Interfaces:
QuantityFactory<Q>
public class DefaultQuantityFactory<Q extends Quantity<Q>> extends Object implements QuantityFactory<Q>
A factory producing simple quantities instances (tuplesNumber/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.5, $Date: 2022-05-21 $
- Author:
- Martin Desruisseaux, Werner Keil, Jean-Marie Dautelle, Otavio Santana
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Quantity<Q>create(Number value, Unit<Q> unit)Quantity<Q>create(Number value, Unit<Q> unit, Quantity.Scale sc)booleanequals(Object obj)static <Q extends Quantity<Q>>
QuantityFactory<Q>getInstance(Class<Q> type)Returns the default instance for the specified quantity type.Unit<Q>getSystemUnit()inthashCode()StringtoString()
-
-
-
Method Detail
-
getInstance
public static <Q extends Quantity<Q>> 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 Quantity<Q> create(Number value, Unit<Q> unit)
- Specified by:
createin interfaceQuantityFactory<Q extends Quantity<Q>>
-
create
public Quantity<Q> create(Number value, Unit<Q> unit, Quantity.Scale sc)
- Specified by:
createin interfaceQuantityFactory<Q extends Quantity<Q>>
-
getSystemUnit
public Unit<Q> getSystemUnit()
- Specified by:
getSystemUnitin interfaceQuantityFactory<Q extends Quantity<Q>>
-
-