-
Notifications
You must be signed in to change notification settings - Fork 217
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
#252 Added new serializer based on GSon library #265
base: 2.0
Are you sure you want to change the base?
Conversation
Signed-off-by: Vladimir Kadychevski <v.kadychevski@gmail.com>
Thanks for submitting the PR ! Could you please check it, it seem that there are compilation errors in the CI. |
Yust pulled this branch on top of #255 , but still get a compilation error:
changed it to |
updatedJson = JsonPath.parse(originalJson, jsonPathconfiguration).set(path, newValue).jsonString(); | ||
} | ||
return new WriteRequestValues(deserialize(pOuterObject.getClass().getName(), updatedJson), originalValue); | ||
} |
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.
The important point here is that pOuterObject
is updated inline. It's not about getting an updated JSON structure but the object itself needs to be updated. That is what the JMX write operation is for, you update an JMX attribute. In that case not the attribute itself but at a deeper level (this is a feature of Jolokia). Afaiu do you only upate a JSON representation of the object here which you then is returned.
It probably arguable whether this feature really belongs into a serializer. Maybe we should move this setInnerValue()
completely out of this interface and make it an intrinsic feature of Jolokia. I remember that I tried that sometimes ago, but failed.
The more I think about it, this method really doesn't belong here as it does have to do with serialization only marginally. I'll try to move this out of the serializer, though not sure wheter I suceed.
Any idea welcome here ;-)
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.
I tried to get rid of the setInnerValue()
method in the interface. Unortunately its quite involved since the (recursive) internal JSON serialization is highly interwoven with the data extraction part needed to extract the object on which to set the value.
For the moment I can see two solutions:
- Allow for an 'UnsupportedOperation' exception when a serializer doesn't support setting an inner value with a write operation. I don't know how often this functionality is used in the wild, but I have the feeling its a too small feature to justify the amount of work needed to restructure this whole module. An implementation can still decide whether it wants to support this, but need todo its own reflection to obtain an inner Java object.
- Move the extractor part from the Jolokia serializer in a core package, so that the reflection code used for setting inner values can be used directly and one could remove the
setInnerValue()
from the interface. The drawback here is, that moving this part into core, 90% of the serialization code would move, too, defeating the modularisation and replaceability of the serializer component.
Any thought, what would be the better approach ?
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.
Hello,
Sorry for the delay.
I feel like in theory the second option is better as this does not have to do a lot with serializer purpose. It may result in an important code impact and dependencies (aka serialization) will be a problem as you stated above. There's no quick win here from code perspective.
This is why in practice I would vote for the first option, mainly for its simplicity.
Kind regards,
Vladimir
First implementation of a GSon-based Serializer