fix: fixed not-found types by importing enums directly

This commit is contained in:
Yannik Bretschneider 2021-06-05 16:10:41 +02:00
parent b8996ade85
commit ebf9e3e393

View File

@ -7,6 +7,10 @@ import com.fasterxml.jackson.annotation.JsonTypeInfo;
import uulm.teamname.marvelous.gamelibrary.messages.client.*; import uulm.teamname.marvelous.gamelibrary.messages.client.*;
import uulm.teamname.marvelous.gamelibrary.messages.server.*; import uulm.teamname.marvelous.gamelibrary.messages.server.*;
import com.fasterxml.jackson.annotation.JsonTypeInfo.As;
import com.fasterxml.jackson.annotation.JsonTypeInfo.Id;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import java.util.Objects; import java.util.Objects;
/** /**
@ -14,7 +18,7 @@ import java.util.Objects;
* messageType, as fields that aren't sent are null. Note that most messages are not deserialized into the {@link * messageType, as fields that aren't sent are null. Note that most messages are not deserialized into the {@link
* BasicMessage}, but instead into messages such as the {@link EventMessage} or {@link GameAssignmentMessage}. * BasicMessage}, but instead into messages such as the {@link EventMessage} or {@link GameAssignmentMessage}.
*/ */
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "messageType") @JsonTypeInfo(use = Id.NAME, include = As.EXISTING_PROPERTY, property = "messageType")
@JsonSubTypes({ @JsonSubTypes({
@Type(value = HelloClientMessage.class, name = "HELLO_CLIENT"), @Type(value = HelloClientMessage.class, name = "HELLO_CLIENT"),
@Type(value = HelloServerMessage.class, name = "HELLO_SERVER"), @Type(value = HelloServerMessage.class, name = "HELLO_SERVER"),
@ -30,7 +34,7 @@ import java.util.Objects;
@Type(value = RequestMessage.class, name = "REQUESTS"), @Type(value = RequestMessage.class, name = "REQUESTS"),
@Type(value = GoodbyeClientMessage.class, name = "GOODBYE_CLIENT") @Type(value = GoodbyeClientMessage.class, name = "GOODBYE_CLIENT")
}) })
@JsonInclude(JsonInclude.Include.NON_NULL) @JsonInclude(Include.NON_NULL)
public class BasicMessage { public class BasicMessage {
/* The messageType describes the type of message that might be sent. Override this with the local MessageType. */ /* The messageType describes the type of message that might be sent. Override this with the local MessageType. */