}
}
ImmutableList.Builder<Link> links = ImmutableList.builder();
for (Map<String, String> linkMap : (List<Map<String, String>>) scalingPolicyMap.get("links")) {
Link link = Link.builder().href(URI.create(linkMap.get("href"))).relation(Relation.fromValue(linkMap.get("rel"))).build();
links.add(link);
}
Double d = (Double)scalingPolicyMap.get(targetType.toString()); // GSON only knows double now
ScalingPolicy scalingPolicyResponse =
new ScalingPolicy(
(String)scalingPolicyMap.get("name"),
ScalingPolicyType.getByValue((String)scalingPolicyMap.get("type")).get(),
((Double)scalingPolicyMap.get("cooldown")).intValue(),
DoubleMath.isMathematicalInteger(d) ? Integer.toString(d.intValue()) : Double.toString(d),
targetType,
(Map<String, String>) scalingPolicyMap.get("args"),
ImmutableList.copyOf(links.build()),
(String) scalingPolicyMap.get("id")
);
scalingPoliciesList.add(scalingPolicyResponse);
}
ImmutableList.Builder<Link> links = ImmutableList.builder();
for (Map<String, String> linkMap : (List<Map<String, String>>) group.get("links")) {
Link link = Link.builder().href(URI.create(linkMap.get("href"))).relation(Relation.fromValue(linkMap.get("rel"))).build();
links.add(link);
}
String groupId = (String) group.get("id");
return Group.builder()