I want to know how to implement having List of interface Type using EclipseLink MOXy,
Before, using JAXB , The following annotations did the job
class A {
@XmlElements({
@XmlElement(name = "B1", type = B1.class),
@XmlElement(name = "B2", type = B2.class)
})
List< B > list;
}
interface B{}
class B1 implements B {}
class B2 implements B {}
to support List of interface type ???
I lead EclipseLink JAXB (MOXy). I am not able to reproduce your issue. Could you provide the stack trace you are seeing? The following is what I have tried:
Demo
jaxb.properties
input.xml
Output
Using EclipseLink JAXB (MOXy)’s XML Metadata File
MOXy also has an extension to provide the metadata as an XML file. Below is what it would look like for this example:
This metadata file is passed in as a property when the JAXBContext is created:
For more information see: