public class JsonBuilder
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
Response |
build()
Turn the map back to response object.
|
java.lang.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(java.lang.String json)
Create a new map object from the existing json.
|
static JsonBuilder |
createError(java.lang.String msg,
int errorCode)
Create a new map error object.
|
java.util.Map |
getMap()
Get the underlying map.
|
static boolean |
isError(java.util.Map obj)
Check if this is an error doc.
|
boolean |
isset()
Is the object non-empty?
|
static java.util.Map |
jsonToMap(java.lang.String json)
Convert a json string to a Map.
|
static java.lang.String |
mapToJson(java.lang.Object obj)
Convert a map to a json string.
|
JsonBuilder |
put(java.lang.String name,
java.lang.Object val)
Add a non-null value to the map.
|
JsonBuilder |
remove(java.lang.String name)
Remove a value from the map.
|
public static JsonBuilder create(java.lang.String json) throws java.io.IOException
java.io.IOException
public static JsonBuilder create() throws java.io.IOException
java.io.IOException
public static JsonBuilder createError(java.lang.String msg, int errorCode) throws java.io.IOException
java.io.IOException
public JsonBuilder put(java.lang.String name, java.lang.Object val)
public JsonBuilder remove(java.lang.String name)
public java.util.Map getMap()
public Response build()
public java.lang.String buildJson() throws java.io.IOException
java.io.IOException
public Response buildResponse()
public Response buildResponse(int status)
public boolean isset()
public static boolean isError(java.util.Map obj)
public static java.util.Map jsonToMap(java.lang.String json) throws java.io.IOException
java.io.IOException
public static java.lang.String mapToJson(java.lang.Object obj) throws java.io.IOException
java.io.IOException
Copyright © 2012 The Apache Software Foundation