source: events/src/main/java/geniusweb/actions/ActionWithBid.java@ 53

Last change on this file since 53 was 52, checked in by ruud, 21 months ago

Fixed small issues in domaineditor.

File size: 1.2 KB
Line 
1package geniusweb.actions;
2
3import com.fasterxml.jackson.annotation.JsonCreator;
4import com.fasterxml.jackson.annotation.JsonProperty;
5
6import geniusweb.issuevalue.Bid;
7
8/**
9 * An {@link Action} containing a bid. Note that the presense of a bid does not
10 * necessarily mean that an offer was placed for this bid.
11 *
12 */
13public abstract class ActionWithBid extends AbstractAction {
14 private Bid bid;
15
16 @JsonCreator
17 public ActionWithBid(@JsonProperty("actor") PartyId id,
18 @JsonProperty("bid") Bid bid) {
19 super(id);
20 this.bid = bid;
21 }
22
23 /**
24 *
25 * @return the {@link Bid} that this action is about.
26 */
27 public Bid getBid() {
28 return bid;
29 }
30
31 @Override
32 public int hashCode() {
33 final int prime = 31;
34 int result = super.hashCode();
35 result = prime * result + ((bid == null) ? 0 : bid.hashCode());
36 return result;
37 }
38
39 /**
40 * This should work also for derived classes without extra fields.
41 */
42 @Override
43 public boolean equals(Object obj) {
44 if (this == obj)
45 return true;
46 if (!super.equals(obj))
47 return false;
48 if (getClass() != obj.getClass())
49 return false;
50 ActionWithBid other = (ActionWithBid) obj;
51 if (bid == null) {
52 if (other.bid != null)
53 return false;
54 } else if (!bid.equals(other.bid))
55 return false;
56 return true;
57 }
58}
Note: See TracBrowser for help on using the repository browser.