|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface JsonMapper
Specifies how a Facebook JSON-to-Java (and vice-versa) mapper must operate.
Note that implementors must be able to handle illegal JSON in
toJavaObject(String, Class) and toJavaList(String, Class)
in order to correctly process Facebook responses. For example, the Users.getLoggedInUser Legacy API call returns a value like 1240077,
which is not valid JSON.
| 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. |
|
| Method Detail |
|---|
<T> T toJavaObject(String json,
Class<T> type)
throws FacebookJsonMappingException
type.
The Java type must have a visible no-argument constructor.
T - 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.
<T> List<T> toJavaList(String json,
Class<T> type)
throws FacebookJsonMappingException
type.
The Java type must have a visible no-argument constructor.
T - 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.
String toJson(Object object)
throws FacebookJsonMappingException
object, create and return a JSON string that
represents it.
The object's properties will be traversed recursively, allowing for
arbitrarily complex JSON generation.
object - The Java object to map to JSON. Can be a Javabean, List,
or Map.
FacebookJsonMappingException - If an error occurs while mapping Java to JSON.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||