Search in sources :

Example 1 with Error

use of com.willshex.gson.web.service.shared.Error in project blogwt by billy1380.

the class Response method fromJson.

@Override
public void fromJson(JsonObject jsonObject) {
    super.fromJson(jsonObject);
    if (jsonObject.has("status")) {
        JsonElement jsonStatus = jsonObject.get("status");
        if (jsonStatus != null) {
            status = StatusType.fromString(jsonStatus.getAsString());
        }
    }
    if (jsonObject.has("error")) {
        JsonElement jsonError = jsonObject.get("error");
        if (jsonError != null) {
            error = new Error();
            error.fromJson(jsonError.getAsJsonObject());
        }
    }
    if (jsonObject.has("session")) {
        JsonElement jsonSession = jsonObject.get("session");
        if (jsonSession != null) {
            session = new Session();
            session.fromJson(jsonSession.getAsJsonObject());
        }
    }
}
Also used : JsonElement(com.google.gson.JsonElement) Error(com.willshex.gson.web.service.shared.Error) Session(com.willshex.blogwt.shared.api.datatype.Session)

Aggregations

JsonElement (com.google.gson.JsonElement)1 Session (com.willshex.blogwt.shared.api.datatype.Session)1 Error (com.willshex.gson.web.service.shared.Error)1