You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
54 lines
1.2 KiB
54 lines
1.2 KiB
package dev.garrettmills.csx.matterlinkreboot;
|
|
|
|
import com.google.gson.Gson;
|
|
|
|
public class IncomingMessage {
|
|
private String text;
|
|
private String username;
|
|
private String id;
|
|
|
|
public static IncomingMessage[] fromStringArray(String jsonString) {
|
|
Gson gson = new Gson();
|
|
return gson.fromJson(jsonString, IncomingMessage[].class);
|
|
}
|
|
|
|
public static IncomingMessage fromString(String jsonString) {
|
|
Gson gson = new Gson();
|
|
return gson.fromJson(jsonString, IncomingMessage.class);
|
|
}
|
|
|
|
public String toJSON() {
|
|
Gson gson = new Gson();
|
|
return gson.toJson(this);
|
|
}
|
|
|
|
public void setText(String value) {
|
|
this.text = value;
|
|
}
|
|
|
|
public String getText() {
|
|
return this.text;
|
|
}
|
|
|
|
public void setUsername(String value) {
|
|
this.username = value;
|
|
}
|
|
|
|
public String getUsername() {
|
|
return this.username;
|
|
}
|
|
|
|
public void setId(String value) {
|
|
this.id = value;
|
|
}
|
|
|
|
public String getId() {
|
|
return this.id;
|
|
}
|
|
|
|
@Override
|
|
public String toString() {
|
|
return "IncomingMessage<username: " + this.getUsername() + ", message: " + this.getText() + ">";
|
|
}
|
|
}
|