Open arpieb opened 7 years ago
My intent is to provide a utility class for RI (indriya), where one could just write the following:
ComparableQuantity<Time> q = Quantities.getQuantity(1.0, Units.DAY); // any Quantity
XMLEncoder encoder = new XMLEncoder(...);
EncodingUtil.setupXMLEncoder(encoder); // <-- proposed new utility with indriya
encoder.writeObject(q);
@keilw where would you like me to put such a utility class EncodingUtil
? e.g. the quantities package tech.units.indriya.quantity
?
@arpieb feel free to use (copy&paste) the newly proposed class EncodingUtil
from associated PR
I gave it a slightly different name and put it under https://github.com/unitsofmeasurement/uom-clients, have a look, I think "Desktop Client" is good as there might be another approach via JAX-B under https://github.com/unitsofmeasurement/uom-lib similar to the Jackson libraries. Therefore "desktop" involving the "java.desktop" module (not yet applied) sounds OK to me.
Btw, @andi-huber if you're in Vienna over Christmas, I also visit for a couple of days, if you have time, I'd be happy to meet you in person.
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 in this gist. 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:
(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 is package private so I cannot register a DefaultPersistenceDelegate for it to test. Any suggestions as to how I can get this to work?
Thanks! -R