Hello, I am not finding how to resolve a Quantity<?> instance if I am starting with a Number and a Unit<?> instance, using only the javax.measure API. The trouble here is that I don't know the Quantity class at runtime, so I can't call javax.measure.spi.ServiceProvider.getQuantityFactory(Class<Q> quantity) to get the appropriate QuantityFactory on which I could call javax.measure.spi.QuantityFactory.create(Number value, Unit<Q> unit).
I don't know there is a very easy way using Indriya: tech.units.indriya.quantity.Quantities.getQuantity(Number value, Unit<Q> unit) but I am trying to understand how to achieve the same thing with only the javax.measure API. Could you point me in the right direction?
Hello, I am not finding how to resolve a
Quantity<?>instance if I am starting with aNumberand aUnit<?>instance, using only thejavax.measureAPI. The trouble here is that I don't know theQuantityclass at runtime, so I can't calljavax.measure.spi.ServiceProvider.getQuantityFactory(Class<Q> quantity)to get the appropriateQuantityFactoryon which I could calljavax.measure.spi.QuantityFactory.create(Number value, Unit<Q> unit).I don't know there is a very easy way using Indriya:
tech.units.indriya.quantity.Quantities.getQuantity(Number value, Unit<Q> unit)but I am trying to understand how to achieve the same thing with only thejavax.measureAPI. Could you point me in the right direction?