This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.lynden.mapdemo; | |
import java.text.DecimalFormat; | |
import java.util.Objects; | |
public class ProductSummaryBean { | |
protected double price; | |
protected String name; | |
protected String upcCode; | |
protected DecimalFormat priceFormatter; | |
public ProductSummaryBean(double price, String name, String upcCode, DecimalFormat priceFormatter) { | |
this.price = price; | |
this.name = name; | |
this.upcCode = upcCode; | |
this.priceFormatter = priceFormatter; | |
} | |
public double getPrice() { | |
return price; | |
} | |
public String getName() { | |
return name; | |
} | |
public String getUpcCode() { | |
return upcCode; | |
} | |
public DecimalFormat getPriceFormatter() { | |
return priceFormatter; | |
} | |
@Override | |
public int hashCode() { | |
int hash = 7; | |
hash = 79 * hash + (int) (Double.doubleToLongBits(this.price) ^ (Double.doubleToLongBits(this.price) >>> 32)); | |
hash = 79 * hash + Objects.hashCode(this.name); | |
hash = 79 * hash + Objects.hashCode(this.upcCode); | |
hash = 79 * hash + Objects.hashCode(this.priceFormatter); | |
return hash; | |
} | |
@Override | |
public boolean equals(Object obj) { | |
if (this == obj) { | |
return true; | |
} | |
if (obj == null) { | |
return false; | |
} | |
if (getClass() != obj.getClass()) { | |
return false; | |
} | |
final ProductSummaryBean other = (ProductSummaryBean) obj; | |
if (Double.doubleToLongBits(this.price) != Double.doubleToLongBits(other.price)) { | |
return false; | |
} | |
if (!Objects.equals(this.name, other.name)) { | |
return false; | |
} | |
if (!Objects.equals(this.upcCode, other.upcCode)) { | |
return false; | |
} | |
if (!Objects.equals(this.priceFormatter, other.priceFormatter)) { | |
return false; | |
} | |
return true; | |
} | |
@Override | |
public String toString() { | |
return "ProductBean{" + "price=" + price + ", name=" + name + ", upcCode=" + upcCode + ", priceFormatter=" + priceFormatter + '}'; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment