com.google.gson
Class ObjectMapTypeAdapter

java.lang.Object
  extended by com.google.gson.ObjectMapTypeAdapter
All Implemented Interfaces:
com.google.gson.JsonDeserializer<Map<?,?>>, com.google.gson.JsonSerializer<Map<?,?>>

public final class ObjectMapTypeAdapter
extends Object

Default serialization and deserialization of a map type. This implementation really only works well with simple primitive types as the map key. If the key is not a simple primitive then the object is toStringed and that value is used as its key.

Patched depending on this

Author:
Joel Leitch

Constructor Summary
ObjectMapTypeAdapter()
           
 
Method Summary
protected static Map<Object,Object> constructMapType(Type arg0, com.google.gson.JsonDeserializationContext arg1)
           
 Map deserialize(com.google.gson.JsonElement json, Type typeOfT, com.google.gson.JsonDeserializationContext context)
           
protected static com.google.gson.JsonElement serialize(com.google.gson.JsonSerializationContext arg0, Object arg1, Type arg2)
           
 com.google.gson.JsonElement serialize(Map src, Type typeOfSrc, com.google.gson.JsonSerializationContext context)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ObjectMapTypeAdapter

public ObjectMapTypeAdapter()
Method Detail

serialize

public com.google.gson.JsonElement serialize(Map src,
                                             Type typeOfSrc,
                                             com.google.gson.JsonSerializationContext context)

deserialize

public Map deserialize(com.google.gson.JsonElement json,
                       Type typeOfT,
                       com.google.gson.JsonDeserializationContext context)
                throws com.google.gson.JsonParseException
Throws:
com.google.gson.JsonParseException

toString

public String toString()
Overrides:
toString in class Object

serialize

protected static final com.google.gson.JsonElement serialize(com.google.gson.JsonSerializationContext arg0,
                                                             Object arg1,
                                                             Type arg2)

constructMapType

protected static final Map<Object,Object> constructMapType(Type arg0,
                                                           com.google.gson.JsonDeserializationContext arg1)


Copyright © 2009-2011 jclouds. All Rights Reserved.