source: java2python/jackson-t/src/test/javaactions/testcode/actions/AbstractAction.java@ 1031

Last change on this file since 1031 was 741, checked in by wouter, 12 months ago

#252 fixed error message, added new tests, fixed existing tests

File size: 1.4 KB
Line 
1package testcode.actions;
2
3import com.fasterxml.jackson.annotation.JsonAutoDetect;
4import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
5import com.fasterxml.jackson.annotation.JsonCreator;
6import com.fasterxml.jackson.annotation.JsonProperty;
7
8@JsonAutoDetect(fieldVisibility = Visibility.ANY, getterVisibility = Visibility.NONE, setterVisibility = Visibility.NONE, isGetterVisibility = Visibility.NONE)
9public class AbstractAction implements Action {
10
11 private PartyId actor;
12
13 /**
14 *
15 * @param actor the {@link PartyId} of the party executing the action. Usually
16 * the negotiation system will check that parties only use their
17 * own Id when doing actions.
18 */
19 @JsonCreator
20 public AbstractAction(@JsonProperty("actor") PartyId actor) {
21 this.actor = actor;
22 }
23
24 @Override
25 public PartyId getActor() {
26 return actor;
27 }
28
29 @Override
30 public int hashCode() {
31 final int prime = 31;
32 int result = 1;
33 result = prime * result + ((actor == null) ? 0 : actor.hashCode());
34 return result;
35 }
36
37 @Override
38 public boolean equals(Object obj) {
39 if (this == obj)
40 return true;
41 if (obj == null)
42 return false;
43 if (getClass() != obj.getClass())
44 return false;
45 AbstractAction other = (AbstractAction) obj;
46 if (actor == null) {
47 if (other.actor != null)
48 return false;
49 } else if (!actor.equals(other.actor))
50 return false;
51 return true;
52 }
53
54}
Note: See TracBrowser for help on using the repository browser.