package testcode.actions; import org.eclipse.jdt.annotation.NonNull; import com.fasterxml.jackson.annotation.JsonAutoDetect; import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; @JsonAutoDetect(fieldVisibility = Visibility.ANY, getterVisibility = Visibility.NONE, setterVisibility = Visibility.NONE, isGetterVisibility = Visibility.NONE) public class AbstractAction implements Action { private final @NonNull PartyId actor; /** * * @param actor the {@link PartyId} of the party executing the action. * Usually the negotiation system will check that parties only * use their own Id when doing actions. */ @JsonCreator public AbstractAction(@JsonProperty("actor") @NonNull PartyId actor) { this.actor = actor; } @Override public @NonNull PartyId getActor() { return actor; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((actor == null) ? 0 : actor.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; AbstractAction other = (AbstractAction) obj; if (actor == null) { if (other.actor != null) return false; } else if (!actor.equals(other.actor)) return false; return true; } }