}
}
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
ScalingPolicyResponse scalingPolicyResponse =
new ScalingPolicyResponse(
(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,
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()