Hello all! I'm using the UOM-SE library in a simulation project, and am running into a bit of trouble when trying to serialize objects containing
ComparableQuantity objects via XMLEncoder. A minimal sample codebase that exhibits the problem (with most of the original classes involved intact) can be found at
https://gist.github.com/arpieb/d9f469ef9bd7ecefea510f1d2e255e60. The
SimulationParameter objects export, but due to exceptions thrown trying to export the UOM objects, no values show up in the XML output. Errors I am seeing are:
java.lang.InstantiationException: tec.uom.se.quantity.NumberQuantity
Continuing ...
java.lang.RuntimeException: failed to evaluate: <unbound>=Class.new();
Continuing ...
java.lang.InstantiationException: tec.uom.se.quantity.DoubleQuantity
Continuing ...
java.lang.RuntimeException: failed to evaluate: <unbound>=Class.new();
Continuing ...
(repeated several times)
I tried to register a
DefaultPersistenceDelegate on the
XMLEncoder to handle
ComparableQuantity by converting the quantity to a string but it is never getting called - and neither does one registered for
NumberQuantity. Apparently the
DoubleQuantity class does not exist so I cannot register a
DefaultPersistenceDelegate for it. Any suggestions as to how I can get this to work?
Thanks!
-R