We use the jaxb2-maven-plugin (Version 2.2) and we would generate the equal and hashCode Method for each JaxbObject. We have alreade a binding.xjb File to configure anything.
Is there any way to generate this Methods?
If I try to add the arguments -Xequals -XhashCode, i get the following Exception: unbekannter Parameter -Xequals -XhashCode
Configuration:
<configuration> <arguments>-Xequals -XhashCode</arguments> </configuration>
Thank you!
You can generate
hashCode
andequals
with JAXB2 Basics plugins:This will generate deep reflection-free runtime dependencies-free
equals
andhashCode
methods:I personally prefer
-Xequals
and-XhashCode
which generate "strategic" methods. "Strategic" in a sense these method use a passed strategy for equality or hash code calculation:Strategic methods are quite cool because you can customize equality/hash code calculation - for instance log where exactly structure differ. This comes for a price of runtime dependency.
Disclaimer: I'm the author of JAXB2 Basics.