I’m trying to unmarshall some dozer mapping files in order to provide a mapping availability library to a number of applications. But i cant get the JaxB annotations to work correctly. Either the list of mappings us unmarshalled as null or empty
From the mapping file, all i’m interested in is.
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<mappings>
<mapping>
<class-a>package.MySourceClass</class-a>
<class-b>other.package.DestinationClass</class-b>
</mapping>
</mappings>
I have a mappings class
@XmlRootElement(name="mappings")
@XmlAccessorType(XmlAccessType.FIELD)
public class Mappings {
@XmlElementWrapper(name="mappings")
private List<Mapping> mappingEntries = null;
//Getters and setters omitted
and A mapping class
@XmlRootElement(name="mapping")
@XmlAccessorType(XmlAccessType.FIELD)
public class Mapping {
@XmlElement(name ="class-a")
private String classA;
@XmlElement(name = "class-b")
private String classB;
I’ve tried numerous combinations of the annotations and I cant figure out what i’m doing wrong.
Can someone point me in the right direction.
You could do the following:
Mappings
Mapping
Demo
input.xml/Output