T - The typepublic abstract class AbstractJsonReader<T> extends AbstractReader<T,com.google.gwt.json.client.JSONObject> implements JsonReader<T>
| Modifier and Type | Field and Description |
|---|---|
protected JsonRegistry |
jsonRegistry |
handlerManager, idMap, logger| Modifier | Constructor and Description |
|---|---|
protected |
AbstractJsonReader() |
| Modifier and Type | Method and Description |
|---|---|
protected T |
internalRead(com.google.gwt.json.client.JSONObject jsonObject) |
T |
read(com.google.gwt.json.client.JSONObject jsonObject)
Convert the specified JSON object to an instance of T according to the
annotated properties in T.
|
T |
read(String jsonString)
Convert the specified JSON string to an instance of T according to the
annotated properties in T.
|
List<T> |
readList(com.google.gwt.json.client.JSONArray jsonArray)
Convert the specified JSON array to a list of Ts according to the
annotated properties in T.
|
List<T> |
readList(com.google.gwt.json.client.JSONObject jsonObject)
Convert the specified JSON object to a list of Ts according to the
annotated properties in T.
|
List<T> |
readList(com.google.gwt.json.client.JSONObject jsonObject,
String arrayKey)
Convert the specified JSON object to a list of Ts according to the
annotated properties in T.
|
List<T> |
readList(String jsonString)
Convert the specified JSON string to a list of Ts according to the
annotated properties in T.
|
List<T> |
readList(String jsonString,
String arrayKey)
Convert the specified JSON string to a list of Ts according to the
annotated properties in T.
|
protected <O> O |
readObject(com.google.gwt.json.client.JSONValue jsonValue,
JsonReader<O> jsonReader) |
protected <V> V |
readValue(com.google.gwt.json.client.JSONValue jsonValue,
Converter<V> converter) |
addModelReadHandler, fireEvent, idRef, newModel, readId, readIdRefs, readPropertiesclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddModelReadHandlerprotected final JsonRegistry jsonRegistry
public List<T> readList(String jsonString)
JsonReader
Depending on jsonString the following value is returned by this
method:
| jsonString | Result |
|---|---|
null |
null |
| empty / blank string | null |
| empty JSON {} |
null |
| JSON with one key / value, which is null or no array {"foo": null} {"foo": 123} |
null |
| JSON with one key / value, which is an empty array {"foo": []} |
empty list |
| JSON with one key and a non-empty array {"foo": [...]} |
a list of Ts according to the annotated properties in T |
readList in interface JsonReader<T>jsonString - The JSON string used as input. May be null.null (see above).public List<T> readList(String jsonString, String arrayKey)
JsonReader
Depending on jsonString and arrayKey the following value
is returned by this method:
| jsonString | arrayKey | Result |
|---|---|---|
null |
any value | null |
| empty / blank string | any value | null |
| empty JSON {} |
any value | null |
| JSON with a non-existing key {"foo": null} {"foo": 123} {"foo": [...]} |
"bar" | null |
| JSON with the specified key and a value which is null or no array {"foo": null} {"foo": 123} |
"foo" | null |
| JSON with the specified key and a avlue which is an empty array {"foo": []} |
"foo" | empty list |
| JSON with the specified key and a non-empty array {"foo": [...]} |
"foo" | a list of Ts according to the annotated properties in T |
readList in interface JsonReader<T>jsonString - The JSON string used as input. May be null.arrayKey - The key containing the JSON array.null (see above).public List<T> readList(com.google.gwt.json.client.JSONObject jsonObject)
JsonReader
Depending on jsonObject the following value is returned by this
method:
| jsonObject | Result |
|---|---|
null |
null |
| empty JSON {} |
null |
| JSON with one key / value, which is null or no array {"foo": null} {"foo": 123} |
null |
| JSON with one key / value, which is an empty array {"foo": []} |
empty list |
| JSON with one key and a non-empty array {"foo": [...]} |
a list of Ts according to the annotated properties in T |
readList in interface JsonReader<T>jsonObject - The JSON object used as input. May be null.null (see above).public List<T> readList(com.google.gwt.json.client.JSONObject jsonObject, String arrayKey)
JsonReader
Depending on jsonObject and arrayKey the following value
is returned by this method:
| jsonObject | arrayKey | Result |
|---|---|---|
null |
any value | null |
| empty JSON {} |
any value | null |
| JSON with a non-existing key {"foo": null} {"foo": 123} {"foo": [...]} |
"bar" | null |
| JSON with the specified key and a value which is null or no array {"foo": null} {"foo": 123} |
"foo" | null |
| JSON with the specified key and a avlue which is an empty array {"foo": []} |
"foo" | empty list |
| JSON with the specified key and a non-empty array {"foo": [...]} |
"foo" | a list of Ts according to the annotated properties in T |
readList in interface JsonReader<T>jsonObject - The JSON object used as input. May be null.arrayKey - The key containing the JSON array.null (see above).public List<T> readList(com.google.gwt.json.client.JSONArray jsonArray)
JsonReader
Depending on jsonArray the following value is returned by this
method:
| jsonArray | Result |
|---|---|
null |
null |
| empty array [] |
empty list |
| Non-empty array {[...]} |
a list of Ts according to the annotated properties in T |
readList in interface JsonReader<T>jsonArray - The JSON array used as input. May be null.null (see above).public T read(String jsonString)
JsonReader
Depending on jsonString the following value is returned by this
method:
| jsonString | Result |
|---|---|
null |
null |
| empty / blank string | null |
| empty JSON {} |
new instance of T |
| JSON with keys / values {"key": "value", ...} |
an instance of T with the mapped JSON data |
read in interface JsonReader<T>jsonString - The JSON string used as input. May be null.null (see
above).public T read(com.google.gwt.json.client.JSONObject jsonObject)
JsonReader
Depending on jsonObject the following value is returned by this
method:
| jsonObject | Result |
|---|---|
null |
null |
| empty JSON {} |
new instance of T |
| JSON with keys / values {"key": "value", ...} |
an instance of T with the mapped JSON data |
read in interface JsonReader<T>jsonObject - The JSON object used as input. May be null.null (see
above).protected T internalRead(com.google.gwt.json.client.JSONObject jsonObject)
protected <V> V readValue(com.google.gwt.json.client.JSONValue jsonValue,
Converter<V> converter)
protected <O> O readObject(com.google.gwt.json.client.JSONValue jsonValue,
JsonReader<O> jsonReader)
Copyright © 2012 Harald Pehl. All Rights Reserved.