Example usage for com.google.gson JsonDeserializationContext deserialize

List of usage examples for com.google.gson JsonDeserializationContext deserialize

Introduction

In this page you can find the example usage for com.google.gson JsonDeserializationContext deserialize.

Prototype

public <T> T deserialize(JsonElement json, Type typeOfT) throws JsonParseException;

Source Link

Document

Invokes default deserialization on the specified object.

Usage

From source file:org.cmg.jresp.json.GroupPredicateDeserializer.java

License:Open Source License

private GroupPredicate doDeserializeAndPredicate(JsonObject json, JsonDeserializationContext context) {
    return new And((GroupPredicate) context.deserialize(json.get("left"), GroupPredicate.class),
            (GroupPredicate) context.deserialize(json.get("right"), GroupPredicate.class));
}

From source file:org.cmg.jresp.json.GroupPredicateDeserializer.java

License:Open Source License

private GroupPredicate doDeserializeOrPredicate(JsonObject json, JsonDeserializationContext context) {
    return new Or((GroupPredicate) context.deserialize(json.get("left"), GroupPredicate.class),
            (GroupPredicate) context.deserialize(json.get("right"), GroupPredicate.class));
}

From source file:org.cmg.jresp.json.MessageDeserializer.java

License:Open Source License

@Override
public jRESPMessage deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context)
        throws JsonParseException {
    if (json.isJsonObject()) {
        JsonObject o = json.getAsJsonObject();
        return doDeserialize((MessageType) context.deserialize(o.get("type"), MessageType.class), o, context);
    }/*ww w .  j a v  a 2s . c  o m*/
    throw new IllegalStateException("This is not a Message!");
}

From source file:org.cmg.jresp.json.MessageDeserializer.java

License:Open Source License

private jRESPMessage doDeserializeGroupGetRequest(JsonObject json, JsonDeserializationContext context) {
    return new GroupGetRequest((PointToPoint) context.deserialize(json.get("source"), PointToPoint.class),
            json.get("session").getAsInt(),
            (Template) context.deserialize(json.get("template"), Template.class),
            (GroupPredicate) context.deserialize(json.get("groupPredicate"), GroupPredicate.class));
}

From source file:org.cmg.jresp.json.MessageDeserializer.java

License:Open Source License

private jRESPMessage doDeserializeGroupQueryRequest(JsonObject json, JsonDeserializationContext context) {
    return new GroupQueryRequest((PointToPoint) context.deserialize(json.get("source"), PointToPoint.class),
            json.get("session").getAsInt(),
            (Template) context.deserialize(json.get("template"), Template.class),
            (GroupPredicate) context.deserialize(json.get("groupPredicate"), GroupPredicate.class));
}

From source file:org.cmg.jresp.json.MessageDeserializer.java

License:Open Source License

private jRESPMessage doDeserializeGroupPutRequest(JsonObject json, JsonDeserializationContext context) {
    return new GroupPutRequest((PointToPoint) context.deserialize(json.get("source"), PointToPoint.class),
            json.get("session").getAsInt(),
            (GroupPredicate) context.deserialize(json.get("groupPredicate"), GroupPredicate.class),
            (Tuple) context.deserialize(json.get("tuple"), Tuple.class));
}

From source file:org.cmg.jresp.json.MessageDeserializer.java

License:Open Source License

private jRESPMessage doDeserializeGroupGetReply(JsonObject json, JsonDeserializationContext context) {
    return new GroupGetReply((PointToPoint) context.deserialize(json.get("source"), PointToPoint.class),
            json.get("session").getAsInt(), json.get("target").getAsString(),
            json.get("tupleSession").getAsInt(),
            (Attribute[]) context.deserialize(json.get("values"), Attribute[].class),
            (Tuple) context.deserialize(json.get("tuple"), Tuple.class));
}

From source file:org.cmg.jresp.json.MessageDeserializer.java

License:Open Source License

private jRESPMessage doDeserializeGroupQueryReply(JsonObject json, JsonDeserializationContext context) {
    return new GroupQueryReply((PointToPoint) context.deserialize(json.get("source"), PointToPoint.class),
            json.get("session").getAsInt(), json.get("target").getAsString(),
            (Tuple) context.deserialize(json.get("tuple"), Tuple.class));
}

From source file:org.cmg.jresp.json.MessageDeserializer.java

License:Open Source License

private jRESPMessage doDeserializeAck(JsonObject json, JsonDeserializationContext context) {
    return new Ack((PointToPoint) context.deserialize(json.get("source"), PointToPoint.class),
            json.get("session").getAsInt(), json.get("target").getAsString());
}

From source file:org.cmg.jresp.json.MessageDeserializer.java

License:Open Source License

private jRESPMessage doDeserializeFail(JsonObject json, JsonDeserializationContext context) {
    return new Fail((PointToPoint) context.deserialize(json.get("source"), PointToPoint.class),
            json.get("session").getAsInt(), json.get("target").getAsString(),
            json.get("message").getAsString());
}