adoroszlai commented on code in PR #6400:
URL: https://github.com/apache/ozone/pull/6400#discussion_r1533959981
##########
hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/server/JsonUtils.java:
##########
@@ -81,6 +83,22 @@ public static JsonNode readTree(String content) throws
IOException {
return MAPPER.readTree(content);
}
+ public static HashMap<String, Object> getResponseMap(String response)
+ throws IOException {
+ return MAPPER.readValue(response,
+ new TypeReference<HashMap<String, Object>>() {
+ });
+ }
+
+ public static List<HashMap<String, Object>> readTreeAsListOfMaps(String json)
+ throws IOException {
+ ObjectMapper objectMapper = new ObjectMapper();
+ return objectMapper.readValue(json,
+ new TypeReference<List<HashMap<String, Object>>>() {
+ });
+ }
Review Comment:
The name `getResponseMap` is specific to the usage in namespace CLI. Also,
why do we need both methods? Can we keep only `readTreeAsListOfMaps` and let
it use `MAPPER`?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]