When using JAXB2, depending on the number of elements defined in the the XML schema, the unmarshalled objects can be of type either MyClass (exactly one element) or JAXBElement<MyClass> (more than one element) -- see http://weblogs.java.net/blog/2006/03...mes-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 on the marshaller (JAXB in this case).
What do you think?