@Override
public JsonElement serialize(FlowletSpecification src, Type typeOfSrc, JsonSerializationContext context) {
JsonObject jsonObj = new JsonObject();
jsonObj.add("className", new JsonPrimitive(src.getClassName()));
jsonObj.add("name", new JsonPrimitive(src.getName()));
jsonObj.add("description", new JsonPrimitive(src.getDescription()));
jsonObj.add("failurePolicy", new JsonPrimitive(src.getFailurePolicy().name()));
jsonObj.add("properties", serializeMap(src.getProperties(), context, String.class));
jsonObj.add("resources", context.serialize(src.getResources(),
new TypeToken<ResourceSpecification>() { }.getType()));
jsonObj.add("maxInstances", new JsonPrimitive(src.getMaxInstances()));
return jsonObj;
}