lmccay commented on a change in pull request #296: KNOX-2240 - KnoxShell Custom 
Command for WEBHDFS Use
URL: https://github.com/apache/knox/pull/296#discussion_r396623893
 
 

 ##########
 File path: 
gateway-shell/src/main/java/org/apache/knox/gateway/shell/KnoxSession.java
 ##########
 @@ -705,6 +734,15 @@ private static String readFileToString(File file) throws 
IOException {
     return obj;
   }
 
+  public static <T> Map<String, T> getMapFromJsonString(String json) throws 
IOException {
+    Map<String, T> obj;
+    JsonFactory factory = new JsonFactory();
+    ObjectMapper mapper = new ObjectMapper(factory);
+    TypeReference<Map<String, T>> typeRef = new TypeReference<Map<String, 
T>>() {};
+    obj = mapper.readValue(json, typeRef);
+    return obj;
+  }
+
 
 Review comment:
   I'll check why I didn't use that - there was a reason. :)

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to