-
Notifications
You must be signed in to change notification settings - Fork 2
Try to simplify Haoyuans serialization work #36
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
base: main
Are you sure you want to change the base?
Conversation
| m.addDemoJexlTier(); | ||
| m.addDemoJexlTier(); | ||
| m.addDemoJexlTier(); | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@haoyuan-l I have created a unit test for the XML serliazation.
Unfortunately the serialization doesn't behave nicely. I have not been able to configure it to handle the inheritance correctly, and it is getting confused when trying to de-serialize
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are there any errors when you deserialized the tiers list?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, its broken at the moment. There will be some errors, but since these are on worker threads, they only kill those threads. The problem is that the deserializaton itself fails, for example because ctors are missing.
This kind of serialization needs special handling for everything which is not a plain 'java bean' property
| Manager m2 = new Manager(); | ||
|
|
||
| // we get this error: | ||
| // java.lang.RuntimeException: com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Cannot construct instance of `com.benblamey.hom.manager.JexlDeploymentTier` (no Creators, like default constructor, exist): cannot deserialize from Object value (no delegate- or property-based Creator) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@haoyuan-l I can make more progress using JSON.... now it is complaining that the ctor doesn't exist.
The classes need to handle the deserialization....
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@haoyuan-l I can make more progress using JSON.... now it is complaining that the ctor doesn't exist. The classes need to handle the deserialization....
So currently we can serialize the tier list to a JSON file but broke when we deserialized the file. Can you share a snapshot of the JSON file? And also I found a post about deserializing the Arraylist:
https://stackoverflow.com/questions/9829403/deserialize-json-to-arraylistpojo-using-jackson
Not sure... It seems we deserialized to ArrayList without any generic type.
(e.g. List tiers = (List)m_xmlMapper.readValue(fr, ArrayList.class))
No description provided.