Hi Jaxb-Experts,
i am testing jaxb2 and found it very useful, but i am wondering on the
behaviour of jaxb2 when serializing an inheritance relationship. In my
case I have three classes:
//---------------------------
@XmlType
public abstract class Property {
private String description;
public String getDescription() { return description; }
public void setDescription(String description) { this.description =
description;}
}
//---------------------------
@XmlType
public class IntegerProperty extends Property {
private int value;
public int getValue() { return value;}
public void setValue(int value) { this.value=value;}
}
//-------------------------------
import java.util.*;
@XmlRootElement
public class PropertyList {
private List<Property> properties = new ArrayList<Property>();
public void setProperties(List<Property> properties) { this.properties
= properties;}
public List<Property> getProperties() { return properties; }
}
//-------------------------------
My problem is the following: When I create an instance of
'PropertyList', add several 'IntegerProperty' instances to it's
properties-List and write it to a XML file, the XML file does NOT
contain the integer values, ... only the description which where
inherited from the superclass 'Property'. I would expect, that the
integer values where also written to XML.
Best regards,
Alexander