public class JsonBuilder extends Object
Modifier and Type | Method and Description |
---|---|
javax.ws.rs.core.Response |
build()
Turn the map back to response object.
|
String |
buildJson()
Turn the map back to json.
|
javax.ws.rs.core.Response |
buildResponse()
Turn the map back to response object.
|
javax.ws.rs.core.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 errorCode)
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.
|
public static JsonBuilder create(String json) throws IOException
IOException
public static JsonBuilder create() throws IOException
IOException
public static JsonBuilder createError(String msg, int errorCode) throws IOException
IOException
public JsonBuilder put(String name, Object val)
public JsonBuilder remove(String name)
public Map getMap()
public javax.ws.rs.core.Response build()
public String buildJson() throws IOException
IOException
public javax.ws.rs.core.Response buildResponse()
public javax.ws.rs.core.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
Copyright © 2017 The Apache Software Foundation. All rights reserved.