Class JsonHandler
- java.lang.Object
-
- com.alessiodp.core.common.addons.internal.JsonHandler
-
public abstract class JsonHandler extends Object
-
-
Field Summary
Fields Modifier and Type Field Description protected com.google.gson.JsonParserjsonParserprotected ADPPluginplugin
-
Constructor Summary
Constructors Constructor Description JsonHandler(ADPPlugin plugin)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description booleanisJson(String jsonMessage)Is the message json formatted?StringremoveJson(String jsonMessage)Convert a JSON message into a plain messageabstract booleansendMessage(Object user, String jsonMessage)Send a json message to the user
-
-
-
Field Detail
-
plugin
protected final ADPPlugin plugin
-
jsonParser
protected final com.google.gson.JsonParser jsonParser
-
-
Constructor Detail
-
JsonHandler
public JsonHandler(ADPPlugin plugin)
-
-
Method Detail
-
sendMessage
public abstract boolean sendMessage(Object user, String jsonMessage)
Send a json message to the user- Parameters:
user- user that receive the messagejsonMessage- message formatted as json- Returns:
- true if the message has been sent
-
isJson
public boolean isJson(String jsonMessage)
Is the message json formatted?- Parameters:
jsonMessage- message formatted as json- Returns:
- true if the message is correctly formatted as json
-
-