package geniusweb.actions; 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) public class AbstractAction implements Action { private PartyId actor; /** * * @param id 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") PartyId id) { this.actor = id; } @Override public 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; } }