Closed theseeker58 closed 1 year ago
Thanks. Take a look at basicjaxb/higher/tests/ignoring
Thank for your answer. I'm using global.xjb customizations since I don't want to tamper with the external ISO XML 20022 xsd schema. I couldn't understand how to ignore a field. For example using Jackson I can ignore a property this way
<jaxb:bindings node="//xsd:complexType[@name='MessageHeaderType']//xsd:element[@name='CtrlSum']">
<annox:annotate target="field">@com.fasterxml.jackson.annotation.JsonIgnore</annox:annotate>
</jaxb:bindings>
How can I prevent the plugin from calculating hashcode using that field? Using just <arg>-XhashCode</arg>
in pom generates a method that use all properties
Ok, gotcha! No need to use annox. In the above example this works
<jaxb:bindings node="//xsd:complexType[@name='MessageHeaderType']//xsd:element[@name='CtrlSum']">
<hashCode:ignored/>
</jaxb:bindings>
And of course adding this
xmlns:hashCode="http://jvnet.org/basicjaxb/xjc/hashCode"
jaxb:extensionBindingPrefixes="hashCode"
Thank you again!
First, great job mate! Not quite an issue. A nice-to-have instead. It'd be pretty useful to exclude properties from hashCode and/or equals method generation, using annotations in xjb or xsd. Thank you!