From b11acd15b37dfcd820702d92cfd5aaa4167b69b5 Mon Sep 17 00:00:00 2001 From: Amnon Heiman Date: Tue, 19 May 2015 17:50:40 +0300 Subject: [PATCH] JMX API: Adding getListStrValue to APIClient This adds support for getting a List of String from the API. Signed-off-by: Amnon Heiman --- src/main/java/com/cloudius/urchin/api/APIClient.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/cloudius/urchin/api/APIClient.java b/src/main/java/com/cloudius/urchin/api/APIClient.java index 9537f5e..684c0a4 100644 --- a/src/main/java/com/cloudius/urchin/api/APIClient.java +++ b/src/main/java/com/cloudius/urchin/api/APIClient.java @@ -5,6 +5,7 @@ package com.cloudius.urchin.api; import java.io.StringReader; import java.net.InetAddress; +import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.List; @@ -71,8 +72,15 @@ public class APIClient { } public List getListStrValue(String string) { - // TODO Auto-generated method stub - return null; + JsonReader reader = getReader(string); + JsonArray arr = reader.readArray(); + List res = new ArrayList(arr.size()); + for (int i = 0; i < arr.size(); i++) { + res.add(arr.getString(i)); + } + reader.close(); + return res; + } public Map, List> getMapListStrValue(String string) {