|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.anotheria.maf.json.JSONResponse
public class JSONResponse
JSON error response.
| Field Summary | |
|---|---|
static String |
ERRORS_SCOPE_GLOBAL_ERRORS
Errors scope global errors. |
static String |
ROOT_COMMANDS_SCOPE
Commands root scope. |
static String |
ROOT_DATA_SCOPE
Data root scope. |
static String |
ROOT_ERRORS_SCOPE
Errors root scope. |
static String |
STATUS_JSON_FIELD
Status json field name. |
| Constructor Summary | |
|---|---|
JSONResponse()
Default constructor. |
|
| Method Summary | |
|---|---|
void |
addCommand(String name,
String param)
Add command to response. |
void |
addError(String error)
Add global error for this response-scope. |
void |
addError(String fieldName,
String error)
Add field error for this response-scope. |
void |
addRawData(String key,
String value)
Add some raw data to response. |
boolean |
equals(Object obj)
|
JSONErrorScope |
getErrorObject(String objectName)
Get error object to error scope. |
Map<String,String> |
getRawData()
Get response raw data |
boolean |
hasErrors()
Is response have errors. |
int |
hashCode()
|
void |
setData(org.json.JSONObject aData)
Set response data. |
org.json.JSONObject |
toJSON()
Convert response to JSONObject. |
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final String STATUS_JSON_FIELD
public static final String ROOT_DATA_SCOPE
public static final String ROOT_COMMANDS_SCOPE
public static final String ROOT_ERRORS_SCOPE
public static final String ERRORS_SCOPE_GLOBAL_ERRORS
| Constructor Detail |
|---|
public JSONResponse()
| Method Detail |
|---|
public void setData(org.json.JSONObject aData)
aData - - response data
public void addRawData(String key,
String value)
key - - keyvalue - - valuepublic Map<String,String> getRawData()
Map with raw data
public void addCommand(String name,
String param)
name - - command nameparam - - command parameterpublic void addError(String error)
JSONErrorScope
addError in interface JSONErrorScopeerror - - error text
public void addError(String fieldName,
String error)
JSONErrorScope
addError in interface JSONErrorScopefieldName - - field nameerror - - error textpublic JSONErrorScope getErrorObject(String objectName)
JSONErrorScope
getErrorObject in interface JSONErrorScopeobjectName - - inner error object name in error scope
JSONErrorScopepublic boolean hasErrors()
true if have or falsepublic org.json.JSONObject toJSON()
JSONObject.
JSONObjectpublic String toString()
toString in class Objectpublic int hashCode()
hashCode in class Objectpublic boolean equals(Object obj)
equals in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||