package geniusweb.actions; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; import geniusweb.issuevalue.Bid; /** * An {@link Action} containing a bid. Note that the presense of a bid does not * necessarily mean that an offer was placed for this bid. * */ public abstract class ActionWithBid extends AbstractAction { private Bid bid; @JsonCreator public ActionWithBid(@JsonProperty("actor") PartyId id, @JsonProperty("bid") Bid bid) { super(id); this.bid = bid; } /** * * @return the {@link Bid} that this action is about. */ public Bid getBid() { return bid; } @Override public int hashCode() { final int prime = 31; int result = super.hashCode(); result = prime * result + ((bid == null) ? 0 : bid.hashCode()); return result; } /** * This should work also for derived classes without extra fields. */ @Override public boolean equals(Object obj) { if (this == obj) return true; if (!super.equals(obj)) return false; if (getClass() != obj.getClass()) return false; ActionWithBid other = (ActionWithBid) obj; if (bid == null) { if (other.bid != null) return false; } else if (!bid.equals(other.bid)) return false; return true; } }