|
|
@@ -24,6 +24,22 @@ public class JacksonUtil {
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ public static List<String> parseStringList(String body, String field) {
|
|
|
+ ObjectMapper mapper = new ObjectMapper();
|
|
|
+ JsonNode node = null;
|
|
|
+ try {
|
|
|
+ node = mapper.readTree(body);
|
|
|
+ JsonNode leaf = node.get(field);
|
|
|
+
|
|
|
+ if(leaf != null)
|
|
|
+ return mapper.convertValue(leaf, new TypeReference<List<String>>(){});
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
public static Integer parseInteger(String body, String field) {
|
|
|
ObjectMapper mapper = new ObjectMapper();
|
|
|
JsonNode node = null;
|
|
|
@@ -46,7 +62,7 @@ public class JacksonUtil {
|
|
|
JsonNode leaf = node.get(field);
|
|
|
|
|
|
if(leaf != null)
|
|
|
- return mapper.convertValue(leaf, new TypeReference<List<String>>(){});
|
|
|
+ return mapper.convertValue(leaf, new TypeReference<List<Integer>>(){});
|
|
|
} catch (IOException e) {
|
|
|
e.printStackTrace();
|
|
|
}
|