#
Ucum-Java Legacy Support
ucumate offers a drop-in replacement module for Ucum-java.
<dependency>
<groupId>io.github.fhnaumann</groupId>
<artifactId>ucumate-ucumjava-bridge</artifactId>
<version>1.0.8</version>
</dependency>
You can construct a UcumateToUcumJavaService which implements most of the functionality from the Ucum-java interface definition.
Below you find a detailed description on the differences to the old Ucum-java implementation.
#
General Differences
Error Feedback
Ucum-java provides some basic feedback when an action failed. I.e. if the given input is invalid, it will return a string
message with details. If the input is valid, it returns null. The ucumate-ucumjava-bridge implementation does not return
(the same) string error messages. You should only rely on == null or != null checks but not on the string contents itself.
#
Functional XML Test Difference
Please see the tests page for the difference between ucum-java and ucumate. The ucumate-ucumjava-bridge does change any validation or conversion logic
compared to the core implementation.
#
Functional JSON Test Difference
During the development of ucumate, a new additional test suite has been created. This adds more extensive edge case tests, but it also has some slightly different validation rules which will be highlighted below.
Here are all the test cases from the JSON tests where ucum-java differs from ucumate. The ucumate-ucumjava-bridge does change any validation or conversion logic
compared to the core implementation.
Normalizing with Special Units
Special units are not allowed to be part of an expression that also contains a division. I.e. Cel/m is invalid. Now it is unclear how this
behaves in regard to expression normalization. I.e. m/m canonicalizes to 1. Should therefore Cel/Cel normalize to 1 and be counted
as a valid UCUM expression? Currently, this is not the case in ucumate and it will show Cel/Cel as invalid.
Please get in contact if you have an opinion on this.