Specify @XmlJavaTypeAdapter class via bindings file?

后端 未结 2 377
孤街浪徒
孤街浪徒 2020-12-19 07:12

I have a 3rd party interface that supplies xsd files that matches their API. Some of their mappings are not quite Java, the usual boolean as 0 & 1 :-(

I\'d like

2条回答
  •  盖世英雄少女心
    2020-12-19 07:39

    It's a super late response, I realize, but even mvv's response left me struggling to totally grasp what I was doing and where in the structure the new element fit, so I wanted to add some further detail for anyone coming across this later.

    Per mvv, the easiest answer is to change to using the xjc:javaType. See jaxb customization for the detailed documentation on using xjc:javaType.

    You'll also need to change your custom adapter (BooleanAdapter) to implement the XmlAdapter interface.

    Ultimately, your binding would instead look like this:

    
    
        
            
                
                
            
        
    
    

提交回复
热议问题