@Override public JsonElement serialize(WorkerSpecification spec, Type typeOfSrc, JsonSerializationContext context) { JsonObject jsonObj = new JsonObject(); jsonObj.addProperty("className", spec.getClassName()); jsonObj.addProperty("name", spec.getName()); jsonObj.addProperty("description", spec.getDescription()); jsonObj.add("plugins", serializeMap(spec.getPlugins(), context, Plugin.class)); jsonObj.add("properties", serializeMap(spec.getProperties(), context, String.class)); jsonObj.add("resources", context.serialize(spec.getResources(), Resources.class)); jsonObj.add("datasets", serializeSet(spec.getDatasets(), context, String.class)); jsonObj.addProperty("instances", spec.getInstances()); return jsonObj; }
@Override public JsonElement serialize(WorkerSpecification spec, Type typeOfSrc, JsonSerializationContext context) { JsonObject jsonObj = new JsonObject(); jsonObj.addProperty("className", spec.getClassName()); jsonObj.addProperty("name", spec.getName()); jsonObj.addProperty("description", spec.getDescription()); jsonObj.add("plugins", serializeMap(spec.getPlugins(), context, Plugin.class)); jsonObj.add("properties", serializeMap(spec.getProperties(), context, String.class)); jsonObj.add("resources", context.serialize(spec.getResources(), Resources.class)); jsonObj.add("datasets", serializeSet(spec.getDatasets(), context, String.class)); jsonObj.addProperty("instances", spec.getInstances()); return jsonObj; }