public class JsonResponse<R> extends Object implements Serializable
| 构造器和说明 |
|---|
JsonResponse()
Constructor a json response
|
| 限定符和类型 | 方法和说明 |
|---|---|
JsonResponse<R> |
addOtherData(String key,
Object value)
Add other data value
|
static <R> JsonResponse<R> |
failure(String message)
Build a failure json response with message
|
static <R> JsonResponse<R> |
message(boolean status,
String message)
Build a message json response with status and message
|
JsonResponse<R> |
removeOtherData(String key)
Remove other data value
|
JsonResponse<R> |
setCode(int code)
Set response code
|
JsonResponse<R> |
setData(R data)
Set response data
|
JsonResponse<R> |
setMessage(String message)
Set response message
|
JsonResponse<R> |
setOtherData(Map<String,Object> otherData)
Set other data
|
JsonResponse<R> |
setStatus(boolean status)
Set response status
|
static <R> JsonResponse<R> |
success(R data)
Build a success json response with data
|
static <R> JsonResponse<R> |
successMessage(String message)
Build a success json response with message
|
public static <R> JsonResponse<R> success(R data)
data - the success response datapublic static <R> JsonResponse<R> successMessage(String message)
message - the success response messagepublic static <R> JsonResponse<R> message(boolean status, String message)
status - the response statusmessage - the response messagepublic static <R> JsonResponse<R> failure(String message)
message - the failure response messagepublic JsonResponse<R> setOtherData(Map<String,Object> otherData)
otherData - other datapublic JsonResponse<R> addOtherData(String key, Object value)
key - key of other datavalue - value of other datapublic JsonResponse<R> removeOtherData(String key)
key - key of other datapublic JsonResponse<R> setStatus(boolean status)
status - json response statuspublic JsonResponse<R> setCode(int code)
code - json response codepublic JsonResponse<R> setMessage(String message)
message - json response messagepublic JsonResponse<R> setData(R data)
data - json response dataCopyright © 2019. All rights reserved.