Skip to content
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

Implement XmlBeanSerializer.unwrappingSerializer() #83

Closed
SergeyLazarev opened this issue Dec 6, 2013 · 4 comments
Closed

Implement XmlBeanSerializer.unwrappingSerializer() #83

SergeyLazarev opened this issue Dec 6, 2013 · 4 comments

Comments

@SergeyLazarev
Copy link

No description provided.

@pgelinas
Copy link
Member

I've taken a look at this too, and there's two way to solve this:

  • the quick and dirty: Remove final modifier on BeanSerializer#serialize, make new subclass to XmlBeanSerializer (UnwrappingXmlBeanSerializer) which override #serialize (same implementation as UnwrappingBeanSerializer). Will also need to add a plethora of constructor to XmlBeanSerializer and BeanSerializer to enable fluent factories.
  • the long clean road: XmlBeanSerializer shouldn't extends BeanSerializer. We should instead have a XmlBeanSerializerBase which extends BeanSerializerBase, and then have both XmlBeanSerializer and UnwrappingXmlBeanSerializer extends that base. This however re-orders the class hierarchy and XmlBeanSerializer would no longer be a sub-class of BeanSerializer, so that might cause problem.

I think the second solution is the way to go. I might try that soon since I might need unwrapping support in Xml.

@cowtowncoder
Copy link
Member

Unwrapping is challenging thing to support, but if it can be made to work, great.

I thin @pgelinas is probably right; and the reason for existing inheritance hierarchy is due to BeanSerializerBase being introduced via refactoring after XML module was created, and its use not having been retrofitted. So now would be great time to add it, if possible.

@pgelinas
Copy link
Member

Little note: I've quickly hacked with the current class hierarchy and unwrapping is easily supported with the Xml module. Like, really easy: all that was missing is a small class mirroring UnwrappingBeanSerializer and the proper constructor from BeanSerializerBase available all the way down and it works. Given that there wasn't anything complicated with that approach, I'll refactor the class hierarchy in the coming days to properly support that feature. Stay tuned ;)

@cowtowncoder
Copy link
Member

Awesome -- looking forward to this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants