Package com.google.api.client.json
Class GenericJson
java.lang.Object
java.util.AbstractMap<String,Object>
com.google.api.client.util.GenericData
com.google.api.client.json.GenericJson
- Direct Known Subclasses:
AbstractJsonFactoryTest.AnimalGenericJson
,AbstractJsonFactoryTest.ExtendsGenericJson
,JsonWebToken.Header
,JsonWebToken.Payload
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
-
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> -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclone()
Makes a "deep" clone of the generic data, in which the clone is completely independent of the original.final JsonFactory
Returns the JSON factory ornull
for none.Sets the given field value (may benull
) for the given field name.final void
setFactory
(JsonFactory factory) Sets the JSON factory ornull
for none.Returns a pretty-printed serialized JSON string representation ortoString()
ifgetFactory()
isnull
.toString()
Methods inherited from class com.google.api.client.util.GenericData
entrySet, equals, get, getClassInfo, getUnknownKeys, hashCode, put, putAll, remove, setUnknownKeys
Methods inherited from class java.util.AbstractMap
clear, containsKey, containsValue, isEmpty, keySet, size, values
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Field Details
-
jsonFactory
JSON factory ornull
for none.
-
-
Constructor Details
-
GenericJson
public GenericJson()
-
-
Method Details
-
getFactory
Returns the JSON factory ornull
for none.- Since:
- 1.6
-
setFactory
Sets the JSON factory ornull
for none.- Since:
- 1.6
-
toString
- Overrides:
toString
in classGenericData
-
toPrettyString
Returns a pretty-printed serialized JSON string representation ortoString()
ifgetFactory()
isnull
.- Throws:
IOException
- Since:
- 1.6
-
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 classGenericData
-
set
Description copied from class:GenericData
Sets the given field value (may benull
) for the given field name. Any existing value for the field will be overwritten. It may be more slightly more efficient thanGenericData.put(String, Object)
because it avoids accessing the field's original value.Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
- Overrides:
set
in classGenericData
-