Skip to content

Instantly share code, notes, and snippets.

@highsource
Last active January 23, 2019 09:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save highsource/625818b7898dfe4f8ae6 to your computer and use it in GitHub Desktop.
Save highsource/625818b7898dfe4f8ae6 to your computer and use it in GitHub Desktop.
Example of the equals(...) method generated by the JAXB2 SimpleEquals Plugin
public boolean equals(Object object) {
if (!(object instanceof PurchaseOrderType)) {
return false;
}
if (this == object) {
return true;
}
final PurchaseOrderType that = ((PurchaseOrderType) object);
{
USAddress leftShipTo;
leftShipTo = this.getShipTo();
USAddress rightShipTo;
rightShipTo = that.getShipTo();
if (leftShipTo!= null) {
if (rightShipTo!= null) {
if (!leftShipTo.equals(rightShipTo)) {
return false;
}
} else {
return false;
}
} else {
if (rightShipTo!= null) {
return false;
}
}
}
{
USAddress leftBillTo;
leftBillTo = this.getBillTo();
USAddress rightBillTo;
rightBillTo = that.getBillTo();
if (leftBillTo!= null) {
if (rightBillTo!= null) {
if (!leftBillTo.equals(rightBillTo)) {
return false;
}
} else {
return false;
}
} else {
if (rightBillTo!= null) {
return false;
}
}
}
{
String leftComment;
leftComment = this.getComment();
String rightComment;
rightComment = that.getComment();
if (leftComment!= null) {
if (rightComment!= null) {
if (!leftComment.equals(rightComment)) {
return false;
}
} else {
return false;
}
} else {
if (rightComment!= null) {
return false;
}
}
}
{
Items leftItems;
leftItems = this.getItems();
Items rightItems;
rightItems = that.getItems();
if (leftItems!= null) {
if (rightItems!= null) {
if (!leftItems.equals(rightItems)) {
return false;
}
} else {
return false;
}
} else {
if (rightItems!= null) {
return false;
}
}
}
{
XMLGregorianCalendar leftOrderDate;
leftOrderDate = this.getOrderDate();
XMLGregorianCalendar rightOrderDate;
rightOrderDate = that.getOrderDate();
if (leftOrderDate!= null) {
if (rightOrderDate!= null) {
if (!leftOrderDate.equals(rightOrderDate)) {
return false;
}
} else {
return false;
}
} else {
if (rightOrderDate!= null) {
return false;
}
}
}
return true;
}
@cstenkes
Copy link

cstenkes commented Jan 22, 2019

Why does it generate always blocks without if or try-catch?
The code complexity is unnecessary high, and the readability of it is also not the best by this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment