I have two classes A
and B
generated by cxf-codegen-plugin
from my WSDL. A
inherits from B
I would like to add common methods like hashCode()
, equals()
... So, I have the following configuration in POM:
<plugin> <groupId>org.apache.cxf</groupId> <artifactId>cxf-codegen-plugin</artifactId> <version>2.6.0</version> <executions> <execution> <id>generate-sources</id> <phase>generate-sources</phase> <configuration> <wsdlOptions> <wsdlOption> <wsdl>${basedir}/wsdl/PeeringApi.wsdl</wsdl> <extraargs> <extraarg>-xjc-XhashCode</extraarg> <extraarg>-xjc-Xequals</extraarg> <extraarg>-xjc-Xsetters</extraarg> </extraargs> </wsdlOption> </wsdlOptions> </configuration> <goals> <goal>wsdl2java</goal> </goals> </execution> </executions> <dependencies> <dependency> <groupId>org.jvnet.jaxb2_commons</groupId> <artifactId>jaxb2-basics</artifactId> <version>${jaxb2.version}</version> </dependency> </dependencies> </plugin>
I have two questions:
- Is there a way to generate the
equals()
method that does not compare the properties of B
(i.e. does not call super.equals()
)? - How can I tell the plugin to create the
equals()
method, which compares only certain properties of A
(by default it seems that all properties are compared) that I specify?
thanks
source share