|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.restlet.representation.Variant
org.restlet.representation.RepresentationInfo
org.restlet.representation.Representation
org.restlet.representation.CharacterRepresentation
org.restlet.representation.WriterRepresentation
org.restlet.ext.json.JsonRepresentation
public class JsonRepresentation
Representation based on a JSON document. JSON stands for JavaScript Object Notation and is a lightweight data-interchange format.
| Field Summary |
|---|
| Fields inherited from class org.restlet.representation.Representation |
|---|
UNKNOWN_SIZE |
| Constructor Summary | |
|---|---|
JsonRepresentation(JSONArray jsonArray)
Constructor from a JSON array. |
|
JsonRepresentation(JSONObject jsonObject)
Constructor from a JSON object. |
|
JsonRepresentation(JSONStringer jsonStringer)
Constructor from a JSON stringer. |
|
JsonRepresentation(JSONTokener jsonTokener)
Constructor from a JSON tokener. |
|
JsonRepresentation(Map<Object,Object> map)
Constructor from a map object. |
|
JsonRepresentation(Object bean)
Constructor from a bean using reflection to generate JSON names. |
|
JsonRepresentation(Representation jsonRepresentation)
Constructor. |
|
JsonRepresentation(String jsonString)
Constructor from a JSON string. |
|
| Method Summary | |
|---|---|
int |
getIndentingSize()
Returns the number of spaces to use for indentation. |
int |
getIndentSize()
Deprecated. Use getIndentingSize() instead. |
JSONArray |
getJsonArray()
Gets the wrapped JSON array or converts the wrapped representation if needed. |
JSONObject |
getJsonObject()
Gets the wrapped JSON object or converts the wrapped representation if needed. |
JSONTokener |
getJsonTokener()
Gets the wrapped JSON tokener or converts the wrapped representation if needed. |
long |
getSize()
|
boolean |
isIndent()
Deprecated. Use isIndenting() instead. |
boolean |
isIndenting()
Indicates if JSON objects and arrays should be indented. |
void |
setIndent(boolean indenting)
Deprecated. Use setIndenting(boolean) instead. |
void |
setIndenting(boolean indenting)
Indicates if JSON objects and arrays should be indented. |
void |
setIndentingSize(int indentFactor)
Sets the number of spaces to use for indentation. |
void |
setIndentSize(int indentFactor)
Deprecated. Use setIndentingSize(int) instead |
JSONArray |
toJsonArray()
Deprecated. Use getJsonArray() instead. |
JSONObject |
toJsonObject()
Deprecated. Use getJsonObject() instead. |
JSONTokener |
toJsonTokener()
Deprecated. Use getJsonTokener() instead. |
void |
write(Writer writer)
|
| Methods inherited from class org.restlet.representation.WriterRepresentation |
|---|
getReader, release, write |
| Methods inherited from class org.restlet.representation.CharacterRepresentation |
|---|
getChannel, getStream, write |
| Methods inherited from class org.restlet.representation.Representation |
|---|
checkDigest, checkDigest, computeDigest, createEmpty, exhaust, getAvailableSize, getDigest, getDisposition, getDownloadName, getExpirationDate, getRange, getText, isAvailable, isDownloadable, isTransient, setAvailable, setDigest, setDisposition, setDownloadable, setDownloadName, setExpirationDate, setRange, setSize, setTransient |
| Methods inherited from class org.restlet.representation.RepresentationInfo |
|---|
getModificationDate, getTag, setModificationDate, setTag |
| Methods inherited from class org.restlet.representation.Variant |
|---|
createClientInfo, equals, getCharacterSet, getEncodings, getIdentifier, getLanguages, getLocationRef, getMediaType, includes, isCompatible, setCharacterSet, setEncodings, setIdentifier, setIdentifier, setLanguages, setLocationRef, setLocationRef, setMediaType, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public JsonRepresentation(JSONArray jsonArray)
jsonArray - The JSON array.public JsonRepresentation(JSONObject jsonObject)
jsonObject - The JSON object.public JsonRepresentation(JSONStringer jsonStringer)
jsonStringer - The JSON stringer.public JsonRepresentation(JSONTokener jsonTokener)
jsonTokener - The JSON tokener.public JsonRepresentation(Map<Object,Object> map)
map - The map to convert to JSON.JSONObject.JSONObject(Map)public JsonRepresentation(Object bean)
bean - The bean to convert to JSON.JSONObject.JSONObject(Object)
public JsonRepresentation(Representation jsonRepresentation)
throws IOException
jsonRepresentation - A source JSON representation to parse.
IOExceptionpublic JsonRepresentation(String jsonString)
jsonString - The JSON string.| Method Detail |
|---|
public int getIndentingSize()
@Deprecated public int getIndentSize()
getIndentingSize() instead.
public JSONArray getJsonArray()
throws JSONException
JSONException
public JSONObject getJsonObject()
throws JSONException
JSONException
public JSONTokener getJsonTokener()
throws JSONException
JSONExceptionpublic long getSize()
getSize in class Representation@Deprecated public boolean isIndent()
isIndenting() instead.
public boolean isIndenting()
@Deprecated public void setIndent(boolean indenting)
setIndenting(boolean) instead.
indenting - True if JSON objects and arrays should be indented.public void setIndenting(boolean indenting)
indenting - True if JSON objects and arrays should be indented.public void setIndentingSize(int indentFactor)
indentFactor - The number of spaces to use for indentation.@Deprecated public void setIndentSize(int indentFactor)
setIndentingSize(int) instead
indentFactor - The number of spaces to use for indentation.
@Deprecated
public JSONArray toJsonArray()
throws JSONException
getJsonArray() instead.
JSONException
@Deprecated
public JSONObject toJsonObject()
throws JSONException
getJsonObject() instead.
JSONException
@Deprecated
public JSONTokener toJsonTokener()
throws JSONException
getJsonTokener() instead.
JSONException
public void write(Writer writer)
throws IOException
write in class RepresentationIOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||