
generic.online.game.server.gogs.model.socket.Message Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of generic-online-game-server Show documentation
Show all versions of generic-online-game-server Show documentation
Simple tool to create online game server.
The newest version!
package generic.online.game.server.gogs.model.socket;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;
@Data
public class Message {
private String errorMessage;
@JsonIgnore
public boolean isError() {
return StringUtils.isNotEmpty(errorMessage);
}
public String json() {
try {
return new ObjectMapper().writeValueAsString(this);
} catch (Exception e) {
Message m = new Message();
m.errorMessage = e.getMessage();
return m.json();
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy