public class GenericJson extends GenericData implements Cloneable
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.
GenericData.FlagsAbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>| Constructor and Description |
|---|
GenericJson() |
| Modifier and Type | Method and Description |
|---|---|
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() |
entrySet, get, getClassInfo, getUnknownKeys, put, putAll, remove, set, setUnknownKeysclear, containsKey, containsValue, equals, hashCode, isEmpty, keySet, size, valuespublic final JsonFactory getFactory()
null for none.public final void setFactory(JsonFactory factory)
null for none.public String toString()
toString in class AbstractMap<String,Object>public String toPrettyString() throws IOException
toString() if
getFactory() is null.
Upgrade warning: this method now throws an IOException. In prior version 1.11 it did
not throw an exception.
IOExceptionpublic GenericJson clone()
GenericDataclone in class GenericDataCopyright © 2011-2012 Google. All Rights Reserved.