JAXB, Custom bindings, Adapter1.class and Joda-time

前端 未结 7 1665
时光说笑
时光说笑 2021-01-11 15:38

I have a problem with the way JAXB is generating the bound classes for an XML schema (which, for sake of precision, I cannot modify). I want to map a xsd:date type to a Joda

7条回答
  •  爱一瞬间的悲伤
    2021-01-11 15:49

    I was in a WSDL first context: no java at all, just generate a CXF Client from a provided WSDL.

    I was stuck with the ugly Adapter1.java for a long time, but I found the solution there.

    You will use a custom XMLAdapter like already explained.

    The key of this problem was adding the xjc extension to the global binding file:

    
        
           
        
    
    

    xjc extension allow the usage of xjc:javaType that accept adapter parameter. No more static method required !

    Note this seems to work with jaxb 2.1+ only.

提交回复
热议问题