使用 javax.measure 进行 NONSI 和 SI 单位转换的合适包和 maven 存储库

问题描述

我正在开发一种使用 JSR385 SI 单位转换的公制到英制转换方法,但对于非标准单位(英制单位/美制单位系统),我无法使用 Internet 上提供的软件包,即

ServiceProvider provider = ServiceProvider.current();
QuantityFactory<Length> lengthFactory = provider.getQuantityFactory(Length.class);
QuantityFactory<Mass> massFactory = provider.getQuantityFactory(Mass.class);
Quantity<Length> height = lengthFactory.create(1.83,METRE);
// for US measure units,the above line can replaced by the following:
 Quantity<Length> heightUS = lengthFactory.create(6,FOOT);
Quantity<Length> height = heightUS.to(METRE);
Quantity<Mass> mass = massFactory.create(85,KILOGRAM);
// for US measure units,same Could be done from lb as above
    Quantity<Mass> mass = massFactory.create(85,lb);

它不接受 FOOT 和 lb 作为有效参数。温度单位(摄氏度到华氏度)也有同样的问题。

那么任何人都可以帮助解决这个问题。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)