Rev | Line | |
---|
[505] | 1 | package testcode.actions;
|
---|
| 2 |
|
---|
[1116] | 3 | import org.eclipse.jdt.annotation.NonNull;
|
---|
| 4 |
|
---|
[505] | 5 | import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
---|
| 6 | import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
|
---|
| 7 | import com.fasterxml.jackson.annotation.JsonCreator;
|
---|
| 8 | import com.fasterxml.jackson.annotation.JsonProperty;
|
---|
| 9 |
|
---|
| 10 | @JsonAutoDetect(fieldVisibility = Visibility.ANY, getterVisibility = Visibility.NONE, setterVisibility = Visibility.NONE, isGetterVisibility = Visibility.NONE)
|
---|
| 11 | public class AbstractAction implements Action {
|
---|
| 12 |
|
---|
[1116] | 13 | private final @NonNull PartyId actor;
|
---|
[505] | 14 |
|
---|
| 15 | /**
|
---|
| 16 | *
|
---|
[1116] | 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.
|
---|
[505] | 20 | */
|
---|
| 21 | @JsonCreator
|
---|
[1116] | 22 | public AbstractAction(@JsonProperty("actor") @NonNull PartyId actor) {
|
---|
[741] | 23 | this.actor = actor;
|
---|
[505] | 24 | }
|
---|
| 25 |
|
---|
| 26 | @Override
|
---|
[1116] | 27 | public @NonNull PartyId getActor() {
|
---|
[505] | 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.