We have a system where a user can provide data of any unit. The data is stored and potentially converted into any other unit of the same dimension. The is based on the JScience api.
I'd like to produce a list of all supported units, along with all aliases they have. I can't seem to find a way of doing this. Currently I'm just doing this:
for (javax.measure.unit.Unit<?> unit: javax.measure.unit.SI.getInstance().getUnits())
System.out.println(UnitFormat.getInstance().format(unit));
for (javax.measure.unit.Unit<?> unit: javax.measure.unit.NonSI.getInstance().getUnits())
System.out.println(UnitFormat.getInstance().format(unit));
First off, this will only produce a list of the labels, I can't find a way to get at the aliases at all.
Secondly, it doesn't even seem to contain all of the units. If I look in the decompiled file javax.measure.unit.UnitFormat, which appears to be where all the labels are attached; I see the line:
DEFAULT.label(NonSI.ROENTGEN, "Roentgen");
But I do not see "Reontgen" in the output. Does anyone have a solution?