imbajin commented on code in PR #577:
URL: 
https://github.com/apache/incubator-hugegraph-toolchain/pull/577#discussion_r1480967105


##########
hugegraph-client/src/main/java/org/apache/hugegraph/util/JsonUtil.java:
##########
@@ -60,4 +62,17 @@ public static <T> T convertValue(JsonNode node, Class<T> 
clazz) {
                                          e, node);
         }
     }
+
+    public static <T> List<T> fromJson2List(String json, Class<T> clazz) {
+        try {
+            return MAPPER.readValue(json, getCollectionType(List.class, 
clazz));
+        } catch (IOException e) {
+            throw new SerializeException("Failed to deserialize json '%s'", e, 
json);
+        }
+    }
+
+    private static JavaType getCollectionType(Class<?> collectionClass,
+                                              Class<?>... elementClasses) {
+        return 
MAPPER.getTypeFactory().constructParametricType(collectionClass, 
elementClasses);

Review Comment:
   shall we consider moving the JsonUtil to `hugegraph-common` module?



-- 
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]

Reply via email to