-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support JavaBeans XML serialization for Quantities #69
Comments
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 |
@arpieb feel free to use (copy&paste) the newly proposed class |
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
The text was updated successfully, but these errors were encountered: