|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ObjectJsonBuilder
public class JsonBuilder
Helper class to build new json objects with new top level properties. Only add non-null entries.
Method Summary | |
---|---|
Response |
build()
Turn the map back to response object. |
String |
buildJson()
Turn the map back to json. |
Response |
buildResponse()
Turn the map back to response object. |
Response |
buildResponse(int status)
Turn the map back to response object. |
static JsonBuilder |
create()
Create a new map object. |
static JsonBuilder |
create(String json)
Create a new map object from the existing json. |
static JsonBuilder |
createError(String msg,
int code)
Create a new map error object. |
Map |
getMap()
Get the underlying map. |
static boolean |
isError(Map obj)
Check if this is an error doc. |
boolean |
isset()
Is the object non-empty? |
static Map |
jsonToMap(String json)
Convert a json string to a Map. |
static String |
mapToJson(Object obj)
Convert a map to a json string. |
JsonBuilder |
put(String name,
Object val)
Add a non-null value to the map. |
JsonBuilder |
remove(String name)
Remove a value from the map. |
Methods inherited from class Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static JsonBuilder create(String json) throws IOException
IOException
public static JsonBuilder create() throws IOException
IOException
public static JsonBuilder createError(String msg, int code) throws IOException
IOException
public JsonBuilder put(String name, Object val)
public JsonBuilder remove(String name)
public Map getMap()
public Response build()
public String buildJson() throws IOException
IOException
public Response buildResponse()
public Response buildResponse(int status)
public boolean isset()
public static boolean isError(Map obj)
public static Map jsonToMap(String json) throws IOException
IOException
public static String mapToJson(Object obj) throws IOException
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |