Is there a JAXB Plugin which generates Builders?

前端 未结 2 1126
感情败类
感情败类 2021-02-20 00:38

Are you aware of any good JAXB Plugin which generated Builder pattern classes for the generated JAXB classes? Composing domain using JAXB generated classes is really nasty. I s

2条回答
  •  猫巷女王i
    2021-02-20 01:16

    The following snippet from a pom.xml file, uses maven cxf-xjc-plugin to generate the JAXB classes and also leverages jaxb-fluent-api to tack-on fluent interfaces ... which aren't exactly a complete builder pattern on their own ... but I think they leave room for folks to make decent headway in that direction.

            
            
            
                org.apache.cxf
                cxf-xjc-plugin
                2.7.7
                
                    
                        net.java.dev.jaxb2-commons:jaxb-fluent-api:2.1.8
                    
                
                
                    
                        generate-xsd-sources
                        generate-sources
                        
                            xsdtojava
                        
                        
                            ${basedir}/target/generated-sources/cxf-xjc/
                            
                                
                                    ${basedir}/src/main/wsdl/your.xsd
                                    com.your.package.name
                                    
                                        -Xfluent-api
                                    
                                
                            
                        
                    
                
            
    

提交回复
热议问题