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

Last change on this file since 1421 was 1116, checked in by wouter, 3 months ago

#363 small cleanup in test code

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