Package com.google.gson.internal.bind
Class JsonElementTypeAdapter
- java.lang.Object
-
- com.google.gson.TypeAdapter<JsonElement>
-
- com.google.gson.internal.bind.JsonElementTypeAdapter
-
class JsonElementTypeAdapter extends TypeAdapter<JsonElement>
Adapter forJsonElementand subclasses.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) static JsonElementTypeAdapterADAPTER
-
Constructor Summary
Constructors Modifier Constructor Description privateJsonElementTypeAdapter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description JsonElementread(JsonReader in)Reads one JSON value (an array, object, string, number, boolean or null) and converts it to a Java object.private JsonElementreadTerminal(JsonReader in, JsonToken peeked)Reads aJsonElementwhich cannot have any nested elementsprivate JsonElementtryBeginNesting(JsonReader in, JsonToken peeked)Tries to begin reading a JSON array or JSON object, returningnullif the next element is neither of those.voidwrite(JsonWriter out, JsonElement value)Writes one JSON value (an array, object, string, number, boolean or null) forvalue.-
Methods inherited from class com.google.gson.TypeAdapter
fromJson, fromJson, fromJsonTree, nullSafe, toJson, toJson, toJsonTree
-
-
-
-
Field Detail
-
ADAPTER
static final JsonElementTypeAdapter ADAPTER
-
-
Method Detail
-
tryBeginNesting
private JsonElement tryBeginNesting(JsonReader in, JsonToken peeked) throws java.io.IOException
Tries to begin reading a JSON array or JSON object, returningnullif the next element is neither of those.- Throws:
java.io.IOException
-
readTerminal
private JsonElement readTerminal(JsonReader in, JsonToken peeked) throws java.io.IOException
Reads aJsonElementwhich cannot have any nested elements- Throws:
java.io.IOException
-
read
public JsonElement read(JsonReader in) throws java.io.IOException
Description copied from class:TypeAdapterReads one JSON value (an array, object, string, number, boolean or null) and converts it to a Java object. Returns the converted object.- Specified by:
readin classTypeAdapter<JsonElement>- Returns:
- the converted Java object. May be
null. - Throws:
java.io.IOException
-
write
public void write(JsonWriter out, JsonElement value) throws java.io.IOException
Description copied from class:TypeAdapterWrites one JSON value (an array, object, string, number, boolean or null) forvalue.- Specified by:
writein classTypeAdapter<JsonElement>value- the Java object to write. May be null.- Throws:
java.io.IOException
-
-