Skip to content

Instantly share code, notes, and snippets.

@rtannenbaum
Created April 1, 2014 20:15
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 rtannenbaum/9922218 to your computer and use it in GitHub Desktop.
Save rtannenbaum/9922218 to your computer and use it in GitHub Desktop.
Item.java - Before
public class Item
{
private String sku;
private String barcode;
private boolean backup, removed;
private int external_srr_reservation_id;
private int external_rb_reservation_id;
public Item(String sku, String barcode, boolean backup, int external_rb_reservation_id,
int external_srr_reservation_id)
{
this.sku = sku;
this.barcode = barcode;
this.backup = backup;
this.external_rb_reservation_id = external_rb_reservation_id;
this.external_srr_reservation_id = external_srr_reservation_id;
}
public String getSku()
{
return sku;
}
public String getBarcode()
{
return barcode;
}
public boolean isBackup()
{
return backup;
}
public boolean isRemoved()
{
return removed;
}
public void setRemoved(boolean removed)
{
this.removed = removed;
}
public int getExternalSRRReservationID()
{
return external_srr_reservation_id;
}
public void setExternalSRRReservationID(int externalSRRReservationID)
{
this.external_srr_reservation_id = externalSRRReservationID;
}
public int getExternalRBReservationID()
{
return external_rb_reservation_id;
}
public void setExternalRBReservationID(int external_rb_reservation_id)
{
this.external_rb_reservation_id = external_rb_reservation_id;
}
public boolean equals(Object o)
{
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Item item = (Item) o;
if (barcode != null ? !barcode.equals(item.barcode) : item.barcode != null) return false;
if (sku != null ? !sku.equals(item.sku) : item.sku != null) return false;
return true;
}
public int hashCode()
{
int result = sku != null ? sku.hashCode() : 0;
result = 31 * result + (barcode != null ? barcode.hashCode() : 0);
return result;
}
public String toString()
{
return (removed ? "Removed: " : "") + sku + (barcode == null? "" : " ("+ barcode +")") +
(backup ? " (backup)" : "" );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment