// TODO(piotrkaleta): Do we need multistage strategy at all?
switch (strategy) {
case REGULAR:
return gson.toJson(message.toGson(null, gson));
case MULTISTAGE:
RawStringData data = new RawStringData();
JsonElement rootElement = message.toGson(data, gson);
data.setBaseStringIndex(data.addString(gson.toJson(rootElement)));
return data.serialize();
default:
throw new AssertionError("Unknown JsonStrategy: " + strategy);
}
}