> @@ -201,6 +206,18 @@ public String toString() {
> }
> }
>
> + public static class ImmutableMapDeserializer implements
> JsonDeserializer<ImmutableMap<?,?>> {
> + @Override
> + public ImmutableMap<?,?> deserialize(final JsonElement json, final
> Type type,
> + final JsonDeserializationContext context) throws
> JsonParseException
> + {
> + final Type type2 =
> + ParameterizedTypeImpl.make(Map.class, ((ParameterizedType)
> type).getActualTypeArguments(), null);
> + final Map<?,?> map = context.deserialize(json, type2);
> + return ImmutableMap.copyOf(map);
Is there some way to do this without creating an intermediate map, e.g. by
using an ImmutableMap.builder() and calling some other `context...` method in a
loop for each entry? An intermediate map isn't _that_ expensive, I guess, but I
assume this method will be called quite a lot..?
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/455/files#r15439121