Marshaling a long primitive type using JAXB

前端 未结 4 1894
小鲜肉
小鲜肉 2021-01-18 10:08

To marshal a long primitive type using JAXB, I have used @XmlJavaTypeAdapter annotation, which will adapt non-String type to a String. Even though it throw erro

4条回答
  •  攒了一身酷
    2021-01-18 11:11

    The following might work:

    class User {
        @XmlID
        @XmlJavaTypeAdapter(WSLongAdapter.class)
        @XmlElement(type=Long.class)
        private long id;
        // Other variables
        // Getter & Setter method
    }    
    

提交回复
热议问题