diff --git a/src/main/java/com/scylladb/jmx/api/APIClient.java b/src/main/java/com/scylladb/jmx/api/APIClient.java index f9938f2..58240e8 100644 --- a/src/main/java/com/scylladb/jmx/api/APIClient.java +++ b/src/main/java/com/scylladb/jmx/api/APIClient.java @@ -406,6 +406,28 @@ public class APIClient { return getMapStrValue(string, null); } + public Map getReverseMapStrValue(String string, + MultivaluedMap queryParams) { + if (string.equals("")) { + return null; + } + JsonReader reader = getReader(string, queryParams); + JsonArray arr = reader.readArray(); + Map map = new HashMap(); + for (int i = 0; i < arr.size(); i++) { + JsonObject obj = arr.getJsonObject(i); + if (obj.containsKey("key") && obj.containsKey("value")) { + map.put(obj.getString("value"), obj.getString("key")); + } + } + reader.close(); + return map; + } + + public Map getReverseMapStrValue(String string) { + return getReverseMapStrValue(string, null); + } + public List getListInetAddressValue(String string, MultivaluedMap queryParams) { List vals = getListStrValue(string, queryParams);