@Override public JsonElement serialize(MapReduceSpecification src, Type typeOfSrc, JsonSerializationContext context) { JsonObject jsonObj = new JsonObject(); jsonObj.addProperty("className", src.getClassName()); jsonObj.addProperty("name", src.getName()); jsonObj.addProperty("description", src.getDescription()); jsonObj.add("plugins", serializeMap(src.getPlugins(), context, Plugin.class)); if (src.getDriverResources() != null) { jsonObj.add("driverResources", context.serialize(src.getDriverResources())); } if (src.getMapperResources() != null) { jsonObj.add("mapperResources", context.serialize(src.getMapperResources())); } if (src.getReducerResources() != null) { jsonObj.add("reducerResources", context.serialize(src.getReducerResources())); } if (src.getInputDataSet() != null) { jsonObj.addProperty("inputDataSet", src.getInputDataSet()); } if (src.getOutputDataSet() != null) { jsonObj.addProperty("outputDataSet", src.getOutputDataSet()); } jsonObj.add("datasets", serializeSet(src.getDataSets(), context, String.class)); jsonObj.add("properties", serializeMap(src.getProperties(), context, String.class)); return jsonObj; }
@Override public JsonElement serialize(MapReduceSpecification src, Type typeOfSrc, JsonSerializationContext context) { JsonObject jsonObj = new JsonObject(); jsonObj.addProperty("className", src.getClassName()); jsonObj.addProperty("name", src.getName()); jsonObj.addProperty("description", src.getDescription()); jsonObj.add("plugins", serializeMap(src.getPlugins(), context, Plugin.class)); if (src.getDriverResources() != null) { jsonObj.add("driverResources", context.serialize(src.getDriverResources())); } if (src.getMapperResources() != null) { jsonObj.add("mapperResources", context.serialize(src.getMapperResources())); } if (src.getReducerResources() != null) { jsonObj.add("reducerResources", context.serialize(src.getReducerResources())); } if (src.getInputDataSet() != null) { jsonObj.addProperty("inputDataSet", src.getInputDataSet()); } if (src.getOutputDataSet() != null) { jsonObj.addProperty("outputDataSet", src.getOutputDataSet()); } jsonObj.add("datasets", serializeSet(src.getDataSets(), context, String.class)); jsonObj.add("properties", serializeMap(src.getProperties(), context, String.class)); return jsonObj; }