I want to print out "milliliters" in UCUM format, i.e. "mL":final UnitFormat unitFormat = ServiceProvider.current().getUnitFormatService().getUnitFormat();final Unit<?> unit = MILLI(LITRE);final String unitString=unitFormat.format(unit);不幸的是,这给了我UCUM的"ml",而不是"mL".而且即使JSR 363规范(和源代码)在整个UCUM参考中都使我烦恼,但RI上的UnitFormatService.getAvailableFormatNames()只给了我"ASCII"和默认",所以我不能将getUnitFormat("UCUM")用作JSR. 363规范暗示我应该能够做到(如果只有某人会支持UCUM).Unfortunately this gives me "ml", not "mL" from UCUM. And even though the JSR 363 specification (and source code) teases me throughout with references to the UCUM, UnitFormatService.getAvailableFormatNames() on the RI only gives me "ASCII" and "Default", so I can't use getUnitFormat("UCUM") as the JSR 363 specification hints that I should be able to do (if only someone would support UCUM).那么我在哪里可以得到支持UCUM的JSR 363 UnitFormat实现?So where can I get a JSR 363 UnitFormat implementation supporting the UCUM?推荐答案请参见JSR 363扩展模块 https://github.com/unitsofmeasurement/uom-systems/tree/master/ucum-java8 以获得UCUM支持.See the JSR 363 extension module https://github.com/unitsofmeasurement/uom-systems/tree/master/ucum-java8 for UCUM support.它为Java SE 8上的计量单位统一代码提供支持.目前,UCUM更强大,更强大,解析使用了SymbolMap概念(尽管它对本地不敏感,但基于Java ResourceBundles),因此我们无法将其用于JSR 363 RI.如果可以的话,请使用兼容的Java SE 8端口 UoM SE .It provides support for the Unified Code for Units of Measure on Java SE 8.At the moment UCUM is more powerful and extensive, parsing uses a SymbolMap concept (based on Java ResourceBundles though it is not local-sensitive) so we cannot make it available for the JSR 363 RI. Please use the compatible Java SE 8 port UoM SE if you can. 这篇关于JSR 363的UCUM单位格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
10-11 09:43