|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.restfb.DefaultJsonMapper
public class DefaultJsonMapper
Default implementation of a JSON-to-Java mapper.
| Constructor Summary | |
|---|---|
DefaultJsonMapper()
|
|
| Method Summary | ||
|---|---|---|
|
toJavaList(String json,
Class<T> type)
Given a JSON string, create and return a new instance of a corresponding Java list which contains elements of type type. |
|
|
toJavaObject(String json,
Class<T> type)
Given a JSON string, create and return a new instance of a corresponding Java object of type type. |
|
String |
toJson(Object object)
Given a Java object, create and return a JSON string that
represents it. |
|
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public DefaultJsonMapper()
| Method Detail |
|---|
public <T> List<T> toJavaList(String json,
Class<T> type)
throws FacebookJsonMappingException
JsonMappertype.
The Java type must have a visible no-argument constructor.
toJavaList in interface JsonMapperT - Java type to map to for each element of the list.json - The JSON to be mapped to a Java type.type - Java type token.
List which contains elements of type
type) representation of the JSON input.
FacebookJsonMappingException - If an error occurs while mapping JSON to Java.JsonMapper.toJavaList(java.lang.String, java.lang.Class)
public <T> T toJavaObject(String json,
Class<T> type)
throws FacebookJsonMappingException
JsonMappertype.
The Java type must have a visible no-argument constructor.
toJavaObject in interface JsonMapperT - Java type to map to.json - The JSON to be mapped to a Java type.type - Java type token.
type) representation of the JSON
input.
FacebookJsonMappingException - If an error occurs while mapping JSON to Java.JsonMapper.toJavaObject(java.lang.String, java.lang.Class)
public String toJson(Object object)
throws FacebookJsonMappingException
JsonMapperobject, create and return a JSON string that
represents it.
The object's properties will be traversed recursively, allowing for
arbitrarily complex JSON generation.
toJson in interface JsonMapperobject - The Java object to map to JSON. Can be a Javabean, List,
or Map.
FacebookJsonMappingException - If an error occurs while mapping Java to JSON.JsonMapper.toJson(java.lang.Object)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||