How can I ignore a superclass?

前端 未结 1 1427
心在旅途
心在旅途 2021-01-05 18:09

I\'m trying to write a web service for the java.util.logging api. So I wrote a class MyLogRecord that inherits from LogRecord. I annotated this class with JAX-B

相关标签:
1条回答
  • 2021-01-05 18:48

    You need to mark the parent class @XmlTransient. Since the parent class is in the JRE and cannot be modified by you, you need an alternate mechanism.

    The EclipseLink JAXB (MOXy) implementation offers a means of representing the metadata as XML that you could use:

    http://wiki.eclipse.org/EclipseLink/Examples/MOXy/EclipseLink-OXM.XML

    You can specify some of the metadata using annotations, and the rest as XML. Below is what your document would look like:

    <java-types> 
    
        <java-type name="java.util.logging.LogRecord" xml-transient="true"/>
    
    </java-types>
    

    0 讨论(0)
提交回复
热议问题