T - The model typepublic class PiritiJsonRepresentation<T> extends org.restlet.client.ext.json.JsonRepresentation implements PiritiRepresentation<T>
JsonReader for converting JSON to an
instance of T.| Constructor and Description |
|---|
PiritiJsonRepresentation(JsonReader<T> jsonReader,
org.restlet.client.data.MediaType mediaType)
Constructor for an null JSON value.
|
PiritiJsonRepresentation(JsonReader<T> jsonReader,
org.restlet.client.data.MediaType mediaType,
com.google.gwt.json.client.JSONValue value)
Constructor from an existing JSON value.
|
PiritiJsonRepresentation(JsonReader<T> jsonReader,
org.restlet.client.representation.Representation jsonRepresentation)
Constructor.
|
PiritiJsonRepresentation(JsonReader<T> jsonReader,
String jsonString)
Constructor from a JSON string.
|
| Modifier and Type | Method and Description |
|---|---|
JsonReader<T> |
getJsonReader() |
T |
getModel()
Converts the JSON to an instance of T using the
JsonReader given
as constructor argument. |
List<T> |
getModels()
Converts the JSON to a list of Ts using the
JsonReader given as
constructor argument. |
getJsonObject, getReader, getSize, getStream, getText, getValue, release, setValueappend, exhaust, getAvailableSize, getDisposition, getExpirationDate, getRange, hasKnownSize, isAvailable, isEmpty, isTransient, setAvailable, setDisposition, setExpirationDate, setRange, setSize, setTransientgetModificationDate, getTag, setModificationDate, setTagpublic PiritiJsonRepresentation(JsonReader<T> jsonReader, org.restlet.client.data.MediaType mediaType)
jsonReader - theJsonReader for converting the JSON to an instance of T.mediaType - The representation's media type.public PiritiJsonRepresentation(JsonReader<T> jsonReader, org.restlet.client.data.MediaType mediaType, com.google.gwt.json.client.JSONValue value)
jsonReader - theJsonReader for converting the JSON to an instance of T.mediaType - The representation's media type.value - The source JSON value.public PiritiJsonRepresentation(JsonReader<T> jsonReader, org.restlet.client.representation.Representation jsonRepresentation)
jsonReader - theJsonReader for converting the JSON to an instance of T.jsonRepresentation - A source JSON representation to parse.public PiritiJsonRepresentation(JsonReader<T> jsonReader, String jsonString)
jsonReader - theJsonReader for converting the JSON to an instance of T.jsonString - The JSON string.public JsonReader<T> getJsonReader()
public T getModel() throws IOException
JsonReader given
as constructor argument. Returns null if JsonRepresentation.getJsonObject() or
JsonReader is null.getModel in interface PiritiRepresentation<T>JsonRepresentation.getJsonObject()
or JsonReader is null.IOExceptionpublic List<T> getModels() throws IOException
JsonReader given as
constructor argument. Returns null if JsonRepresentation.getJsonObject() or
JsonReader is null. More precisely the JSON has to be a JSON
object with one key (name does not matter). The value of this key has to
be a JSON array which is converted to instances of T.getModels in interface PiritiRepresentation<T>JsonRepresentation.getJsonObject() or
JsonReader is null.IOExceptionCopyright © 2012 Harald Pehl. All Rights Reserved.