How do I prevent JAXB from binding superclass methods of the @XmlRootElement when marshalling?

后端 未结 6 1817
谎友^
谎友^ 2020-12-30 09:10

I have a class that is annotated as the @XmlRootElement with @XmlAccessorType(XmlAccessType.NONE). The problem that I am having is that the superc

6条回答
  •  一整个雨季
    2020-12-30 10:04

    According to this StackOverflow post: How can I ignore a superclass?

    It is not possible with JAX-B to ignore the superclass without modifying the superclass. Quoting the relevant portion of that post:

    Update2: I found a thread on java.net for a similar problem. That thread resulted in an enhancement request, which was marked as a duplicate of another issue, which resulted in the @XmlTransient annotation. The comments on these bug reports lead me to believe this is impossible in the current spec.

提交回复
热议问题