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

Get rid of the JAXBElement when using Jaxb2Marshaller [SWS-627] #737

Open
gregturn opened this issue Jul 5, 2010 · 0 comments
Open

Get rid of the JAXBElement when using Jaxb2Marshaller [SWS-627] #737

gregturn opened this issue Jul 5, 2010 · 0 comments

Comments

@gregturn
Copy link
Member

@gregturn gregturn commented Jul 5, 2010

Pierre Lecesne opened SWS-627 and commented

When using JAXB2, depending on the number of elements defined in the the XML schema, the unmarshalled objects can be either of type MyClass (exactly one element in the XML schema) or JAXBElement<MyClass> (more than one element) -- see http://weblogs.java.net/blog/2006/03/03/why-does-jaxb-put-xmlrootelement-sometimes-not-always

This would be very useful if the class org.springframework.oxm.jaxb.Jaxb2Marshaller of the Spring Framework could do the abstraction of the JAXBElement for us, ie. :

  • always returning an object of type MyClass when unmarshalling (by calling the getValue() method on the JAXBElement for us).
  • allowing passing an object of type MyClass when marshalling even though a JAXBElement<MyClass> would normally be expected.

Then our code wouldn't have any code dependency upon the chosen marshaller (JAXB in this case).


2 votes, 2 watchers

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

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.