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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.