|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.restlet.client.representation.Variant
org.restlet.client.representation.RepresentationInfo
org.restlet.client.representation.Representation
org.restlet.client.ext.json.JsonRepresentation
name.pehl.piriti.restlet.json.client.PiritiJsonRepresentation<T>
T - The model typepublic class PiritiJsonRepresentation<T>
Representation which uses an JsonReader for converting JSON to an
instance of T.
| Field Summary |
|---|
| Fields inherited from class org.restlet.client.representation.Representation |
|---|
UNKNOWN_SIZE |
| Constructor Summary | |
|---|---|
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. |
|
| Method Summary | |
|---|---|
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. |
| Methods inherited from class org.restlet.client.ext.json.JsonRepresentation |
|---|
getJsonObject, getReader, getSize, getStream, getText, getValue, release, setValue |
| Methods inherited from class org.restlet.client.representation.Representation |
|---|
append, exhaust, getAvailableSize, getDisposition, getExpirationDate, getRange, hasKnownSize, isAvailable, isEmpty, isTransient, setAvailable, setDisposition, setExpirationDate, setRange, setSize, setTransient |
| Methods inherited from class org.restlet.client.representation.RepresentationInfo |
|---|
getModificationDate, getTag, setModificationDate, setTag |
| Methods inherited from class org.restlet.client.representation.Variant |
|---|
createClientInfo, equals, getCharacterSet, getEncodings, getLanguages, getLocationRef, getMediaType, includes, isCompatible, setCharacterSet, setEncodings, setLanguages, setLocationRef, setLocationRef, setMediaType, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public 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.| Method Detail |
|---|
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.
IOException
public 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.
IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||