I would like to marshalling a java object from a java library.
When marshalling a java object using JAXB marschaller, I have got a problem:
class A does not have a no-arg default constructor
I used a Java Decomplier to check the class a implementation, it is like this:
public final class AImpl
implements A
That means I can not extends class AImpl
.
So How can I fix the problem with no-arg default constructor?
You can use XmlAdapter
for this use case. For an example see:
How do you know values that should be passed to that constructor then?
I think you will need to override Binder class to unmarshall objects by yourself.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With