JAXB: 2 подсчета IllegalAnnotationExceptions

Это мой класс Parser

public class Test {
    public static void main(String args[]) throws Exception {

        File file = new File("D:\\Test.xml");
        JAXBContext jaxbContext = JAXBContext.newInstance(MyOrder.class);
        Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();
        MyOrder customer = (MyOrder) jaxbUnmarshaller.unmarshal(file);
        System.out.println(customer.getOrder().getSide());
    }
}

Это файл MyOrder.java

@XmlRootElement(name = "BXML")
public class MyOrder {
    @XmlElement(name = "Bag")
    protected Order order;

    public MyOrder() {

    }
    @XmlAttribute
    public Order getOrder() {
        return order;
    }
    public void setOrder(Order order) {
        this.order = order;
    }
}

Это мой объект домена (Order.java)

@XmlRootElement(name = "BXML")
public class Order {

    public Order() {

    }

    @XmlAttribute(name = "Side")
    protected BigInteger Side;

    @XmlValue
    public BigInteger getSide() {
        return Side;
    }

    public void setSide(BigInteger side) {
        Side = side;
    }
}

Это исключение, которое я получаю, когда я пытался запустить программу

Exception in thread "main" com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 2 counts of IllegalAnnotationExceptions
@XmlAttribute/@XmlValue need to reference a Java type that maps to text in XML.
    this problem is related to the following location:
        at public com.Order com.MyOrder.getOrder()
        at com.MyOrder
Class has two properties of the same name "order"
    this problem is related to the following location:
        at public com.Order com.MyOrder.getOrder()
        at com.MyOrder
    this problem is related to the following location:
        at protected com.Order com.MyOrder.order
        at com.MyOrder
8
задан Pawan 3 April 2012 в 12:30
поделиться