ListAvailablePlugins: Let RestApiServlet do the conversion to JSON Also inline the display() method which had only a single caller. Signed-off-by: Edwin Kempin <ekempin@google.com> Change-Id: I63a9275fe48ce68d8cf81ad82d4fe6a37aa96781
diff --git a/src/main/java/com/googlesource/gerrit/plugins/manager/ListAvailablePlugins.java b/src/main/java/com/googlesource/gerrit/plugins/manager/ListAvailablePlugins.java index 96fb53f..d43bbec 100644 --- a/src/main/java/com/googlesource/gerrit/plugins/manager/ListAvailablePlugins.java +++ b/src/main/java/com/googlesource/gerrit/plugins/manager/ListAvailablePlugins.java
@@ -20,9 +20,6 @@ import com.google.gerrit.extensions.restapi.RestApiException; import com.google.gerrit.extensions.restapi.RestReadView; import com.google.gerrit.extensions.restapi.TopLevelResource; -import com.google.gerrit.json.OutputFormat; -import com.google.gson.JsonElement; -import com.google.gson.reflect.TypeToken; import com.google.inject.Inject; import com.googlesource.gerrit.plugins.manager.repository.PluginInfo; import java.util.ArrayList; @@ -43,11 +40,7 @@ } @Override - public Object apply(TopLevelResource resource) throws RestApiException { - return display(); - } - - public JsonElement display() throws RestApiException { + public Map<String, PluginInfo> apply(TopLevelResource resource) throws RestApiException { Map<String, PluginInfo> output = Maps.newTreeMap(); List<PluginInfo> plugins; try { @@ -68,8 +61,6 @@ output.put(p.name, p); } - return OutputFormat.JSON - .newGson() - .toJsonTree(output, new TypeToken<Map<String, Object>>() {}.getType()); + return output; } }