All Downloads are FREE. Search and download functionalities are using the official Maven repository.

generic.online.game.server.gogs.model.socket.Message Maven / Gradle / Ivy

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