> +
> + Gson gson = new Gson();
> + Type mapType = new TypeToken<Map<String, Object>>(){}.getType();
> + Map<String, String> jsonMap = gson.fromJson(json, mapType);
> +
> + Pattern p = Pattern.compile(String.format(".*%s\\/([a-z|\\-|\\d]*).*",
> prefix));
> + Matcher m = p.matcher(jsonMap.get("href"));
> +
> + if (m.matches()) {
> + String dataCenterId = m.group(1);
> + jsonMap.put(key, dataCenterId);
> + json = (new Gson()).toJson(jsonMap);
> + }
> +
> + return json;
> + }
This class creates several instances of a json parser. Instead, get the jclouds
Json object injected or as a method parameter if you want to keep the static
signature.
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/227/files#r51543984