public class JsonResult extends Object
| Modifier and Type | Class and Description |
|---|---|
class |
JsonResult.FieldMessage
Represents a message (usually a validation error) pertaining to a field
The field name is the name of the POST variable which caused the error
|
| Modifier and Type | Field and Description |
|---|---|
static String |
CONTENT_TYPE |
| Constructor and Description |
|---|
JsonResult() |
JsonResult(boolean status) |
JsonResult(boolean status,
String message) |
JsonResult(boolean status,
String nextHref,
List<String> messages,
List<JsonResult.FieldMessage> fieldMessages) |
JsonResult(boolean status,
String message,
String nextHref) |
| Modifier and Type | Method and Description |
|---|---|
void |
addFieldMessage(String field,
String message) |
static JsonResult |
error(String description) |
static JsonResult |
fieldError(String field,
String fieldMessage) |
Object |
getData()
Any JSON friendly object
|
List<JsonResult.FieldMessage> |
getFieldMessages()
List of messages relating to specific fields.
|
List<String> |
getMessages()
Any messages which are not specific to certain fields
|
String |
getNextHref()
If an object was created this should be the href of that object.
|
boolean |
isStatus()
Flag to indicate success or failure of the operation
|
static JsonResult |
returnData(Object data) |
static JsonResult |
returnData(String href,
Object data) |
void |
setData(Object data) |
void |
setFieldMessages(List<JsonResult.FieldMessage> fieldMessages) |
void |
setMessages(List<String> messages) |
void |
setNextHref(String nextHref) |
void |
setStatus(boolean status) |
public static String CONTENT_TYPE
public JsonResult()
public JsonResult(boolean status,
String nextHref,
List<String> messages,
List<JsonResult.FieldMessage> fieldMessages)
public JsonResult(boolean status)
public JsonResult(boolean status,
String message)
public static JsonResult error(String description)
public static JsonResult fieldError(String field, String fieldMessage)
public static JsonResult returnData(String href, Object data)
public static JsonResult returnData(Object data)
public boolean isStatus()
public void setStatus(boolean status)
status - the status to setpublic String getNextHref()
public void setNextHref(String nextHref)
nextHref - the nextHref to setpublic List<String> getMessages()
public void setMessages(List<String> messages)
messages - the messages to setpublic List<JsonResult.FieldMessage> getFieldMessages()
public void setFieldMessages(List<JsonResult.FieldMessage> fieldMessages)
fieldMessages - the fieldMessages to setpublic Object getData()
public void setData(Object data)