Gamelib/src/main/java/uulm/teamname/marvelous/gamelibrary/requests/Request.java

33 lines
1.1 KiB
Java

package uulm.teamname.marvelous.gamelibrary.requests;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import uulm.teamname.marvelous.gamelibrary.messages.server.EventMessage;
import uulm.teamname.marvelous.gamelibrary.json.ingame.deserialize.RequestDeserializer;
import uulm.teamname.marvelous.gamelibrary.json.ingame.serialize.RequestSerializer;
import java.util.Objects;
/** Represents an abstract request sent inside a {@link EventMessage} between client and server. */
@JsonDeserialize(using = RequestDeserializer.class)
@JsonSerialize(using = RequestSerializer.class)
public abstract class Request {
@JsonProperty("requestType") public RequestType type;
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Request request = (Request) o;
return type == request.type;
}
@Override
public int hashCode() {
return Objects.hash(type);
}
}