Skip to content

Instantly share code, notes, and snippets.

@highsource
Created December 19, 2014 10:46
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save highsource/facf68ce12a4eca50d5c to your computer and use it in GitHub Desktop.
Example of the hashCode() method generated by the JAXB2 SimpleHashCode Plugin
public int hashCode() {
int currentHashCode = 1;
{
currentHashCode = (currentHashCode* 31);
USAddress theShipTo;
theShipTo = this.getShipTo();
if (theShipTo!= null) {
currentHashCode += theShipTo.hashCode();
}
}
{
currentHashCode = (currentHashCode* 31);
USAddress theBillTo;
theBillTo = this.getBillTo();
if (theBillTo!= null) {
currentHashCode += theBillTo.hashCode();
}
}
{
currentHashCode = (currentHashCode* 31);
String theComment;
theComment = this.getComment();
if (theComment!= null) {
currentHashCode += theComment.hashCode();
}
}
{
currentHashCode = (currentHashCode* 31);
Items theItems;
theItems = this.getItems();
if (theItems!= null) {
currentHashCode += theItems.hashCode();
}
}
{
currentHashCode = (currentHashCode* 31);
XMLGregorianCalendar theOrderDate;
theOrderDate = this.getOrderDate();
if (theOrderDate!= null) {
currentHashCode += theOrderDate.hashCode();
}
}
return currentHashCode;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment