jaxb XmlAccessType: PROPERTY example

Posted by Bjorn J on Stack Overflow See other posts from Stack Overflow or by Bjorn J
Published on 2010-05-24T08:18:39Z Indexed on 2010/05/24 8:21 UTC
Read the original article Hit count: 403

Filed under:
|
|

I'm trying to use jaxb and want to use the 'XmlAccessType.PROPERTY' to let jaxb use getters/setters rather than variable directly, but get different errors depending on what I try, or the variable isn't set at all like I want.

Any good link or pointer to a simple example?

For example, the below makes the groupDefintion not to be set when parsing the xml document:

@XmlAccessorType(javax.xml.bind.annotation.XmlAccessType.PROPERTY)
public class E {
    private EGroup groupDefinition;

    public EGroup getGroupDefinition () {
        return groupDefinition;
    }
    @XmlAttribute
    public void setGroupDefinition (EGroup g) {
        groupDefinition = g;
    }
}

© Stack Overflow or respective owner

Related posts about java

Related posts about Xml