com.google.api.client.json
Class GenericJson

java.lang.Object
  extended by java.util.AbstractMap<String,Object>
      extended by com.google.api.client.util.GenericData
          extended by com.google.api.client.json.GenericJson
All Implemented Interfaces:
Cloneable, Map<String,Object>

public class GenericJson
extends GenericData
implements Cloneable

Generic JSON data that stores all unknown key name/value pairs.

Subclasses can declare fields for known data keys using the Key annotation. Each field can be of any visibility (private, package private, protected, or public) and must not be static. null unknown data key names are not allowed, but null data values are allowed.

Implementation is not thread-safe. For a thread-safe choice instead use an implementation of ConcurrentMap.

Since:
1.0
Author:
Yaniv Inbar

Nested Class Summary
 
Nested classes/interfaces inherited from class com.google.api.client.util.GenericData
GenericData.Flags
 
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>
 
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry<K,V>
 
Constructor Summary
GenericJson()
           
 
Method Summary
 GenericJson clone()
          Makes a "deep" clone of the generic data, in which the clone is completely independent of the original.
 JsonFactory getFactory()
          Returns the JSON factory or null for none.
 void setFactory(JsonFactory factory)
          Sets the JSON factory or null for none.
 String toPrettyString()
          Returns a pretty-printed serialized JSON string representation or toString() if getFactory() is null.
 String toString()
           
 
Methods inherited from class com.google.api.client.util.GenericData
entrySet, get, getClassInfo, getUnknownKeys, put, putAll, remove, set, setUnknownKeys
 
Methods inherited from class java.util.AbstractMap
clear, containsKey, containsValue, equals, hashCode, isEmpty, keySet, size, values
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GenericJson

public GenericJson()
Method Detail

getFactory

public final JsonFactory getFactory()
Returns the JSON factory or null for none.

Since:
1.6

setFactory

public final void setFactory(JsonFactory factory)
Sets the JSON factory or null for none.

Since:
1.6

toString

public String toString()
Overrides:
toString in class AbstractMap<String,Object>

toPrettyString

public String toPrettyString()
Returns a pretty-printed serialized JSON string representation or toString() if getFactory() is null.

Since:
1.6

clone

public GenericJson clone()
Description copied from class: GenericData
Makes a "deep" clone of the generic data, in which the clone is completely independent of the original.

Overrides:
clone in class GenericData


Copyright © 2011-2012 Google. All Rights Reserved.