@Override public JsonElement serialize(TwillSpecification.PlacementPolicy src, Type typeOfSrc, JsonSerializationContext context) { JsonObject json = new JsonObject(); json.add("names", context.serialize(src.getNames(), new TypeToken<Set<String>>() { }.getType())); json.addProperty("type", src.getType().name()); json.add("hosts", context.serialize(src.getHosts(), new TypeToken<Set<String>>() { }.getType())); json.add("racks", context.serialize(src.getRacks(), new TypeToken<Set<String>>() { }.getType())); return json; }
@Override public JsonElement serialize(TwillSpecification.PlacementPolicy src, Type typeOfSrc, JsonSerializationContext context) { JsonObject json = new JsonObject(); json.add("names", context.serialize(src.getNames(), new TypeToken<Set<String>>() { }.getType())); json.addProperty("type", src.getType().name()); json.add("hosts", context.serialize(src.getHosts(), new TypeToken<Set<String>>() { }.getType())); json.add("racks", context.serialize(src.getRacks(), new TypeToken<Set<String>>() { }.getType())); return json; }