Search in sources :

Example 1 with DefaultResourceReport

use of com.continuuity.weave.internal.DefaultResourceReport in project weave by continuuity.

the class ResourceReportCodec method deserialize.

@Override
public ResourceReport deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
    JsonObject jsonObj = json.getAsJsonObject();
    String appMasterId = jsonObj.get("appMasterId").getAsString();
    WeaveRunResources masterResources = context.deserialize(jsonObj.get("appMasterResources"), WeaveRunResources.class);
    Map<String, Collection<WeaveRunResources>> resources = context.deserialize(jsonObj.get("runnableResources"), new TypeToken<Map<String, Collection<WeaveRunResources>>>() {
    }.getType());
    return new DefaultResourceReport(appMasterId, masterResources, resources);
}
Also used : TypeToken(com.google.gson.reflect.TypeToken) DefaultResourceReport(com.continuuity.weave.internal.DefaultResourceReport) JsonObject(com.google.gson.JsonObject) Collection(java.util.Collection) WeaveRunResources(com.continuuity.weave.api.WeaveRunResources)

Aggregations

WeaveRunResources (com.continuuity.weave.api.WeaveRunResources)1 DefaultResourceReport (com.continuuity.weave.internal.DefaultResourceReport)1 JsonObject (com.google.gson.JsonObject)1 TypeToken (com.google.gson.reflect.TypeToken)1 Collection (java.util.Collection)1