JAXB compiler is binding xs:boolean to Java Boolean wrapper class, instead of boolean primitive type

后端 未结 4 1705
天涯浪人
天涯浪人 2020-12-09 10:36

I\'m migrating a project from JAXB 1.0 to JAXB 2.1 and I\'m having problems with the datatype mapping.

I\'m using the Ant xjc binding compiler, and I\'ve su

4条回答
  •  萌比男神i
    2020-12-09 10:47

    Try this...

    
        
            
                
            
            
        
    
    

    I found your question as I was looking how to do the exact opposite thing you were doing. I had a boolean attribute that would only generate code that had the attribute as a primitive boolean value. To make jaxb generate this attribute as a Boolean object instead of a boolean primitive, I just removed the use="required" portion of my attribute's definition in the xsd.

提交回复
热议问题