|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectjava.util.AbstractMap
org.astrogrid.samp.SampMap
org.astrogrid.samp.Response
Represents an encoded SAMP response.
| Nested Class Summary |
| Nested classes inherited from class java.util.Map |
Map.Entry |
| Field Summary | |
static String |
ERROR_KEY
Key for error map. |
static String |
ERROR_STATUS
STATUS_KEY value indicating failure. |
static String |
OK_STATUS
STATUS_KEY value indicating success. |
static String |
RESULT_KEY
Key for result map. |
static String |
STATUS_KEY
Key for response status. |
static String |
WARNING_STATUS
STATUS_KEY value indicating partial success. |
| Fields inherited from class org.astrogrid.samp.SampMap |
EMPTY |
| Constructor Summary | |
Response()
Constructs an empty response. |
|
Response(Map map)
Constructs a response based on an existing map. |
|
Response(String status,
Map result,
ErrInfo errinfo)
Constructs a response with given status, result and error. |
|
| Method Summary | |
static Response |
asResponse(Map map)
Returns a map as a Response object. |
void |
check()
Checks that this object is ready for use with the SAMP toolkit. |
static Response |
createErrorResponse(ErrInfo errinfo)
Returns a new response which is an error. |
static Response |
createSuccessResponse(Map result)
Returns a new response which is a success. |
ErrInfo |
getErrInfo()
Returns the error object. |
Map |
getResult()
Returns the result map. |
String |
getStatus()
Returns the status value. |
boolean |
isOK()
Indicates whether the result was an unequivocal success. |
void |
setErrInfo(Map errInfo)
Sets the error object. |
void |
setResult(Map result)
Sets the result map. |
void |
setStatus(String status)
Sets the status value. |
| Methods inherited from class org.astrogrid.samp.SampMap |
checkHasKeys, entrySet, getList, getMap, getString, getUrl, put |
| Methods inherited from class java.util.AbstractMap |
clear, clone, containsKey, containsValue, equals, get, hashCode, isEmpty, keySet, putAll, remove, size, toString, values |
| Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static final String STATUS_KEY
OK_STATUS, WARNING_STATUS or ERROR_STATUS.
public static final String RESULT_KEY
public static final String ERROR_KEY
public static final String OK_STATUS
STATUS_KEY value indicating success.
public static final String WARNING_STATUS
STATUS_KEY value indicating partial success.
public static final String ERROR_STATUS
STATUS_KEY value indicating failure.
| Constructor Detail |
public Response()
public Response(Map map)
map - map containing initial data for this object
public Response(String status,
Map result,
ErrInfo errinfo)
status - STATUS_KEY valueresult - RESULT_KEY valueerrinfo - ERROR_KEY value| Method Detail |
public void setStatus(String status)
status - STATUS_KEY valuepublic String getStatus()
STATUS_KEY valuepublic void setResult(Map result)
result - RESULT_KEY valuepublic Map getResult()
RESULT_KEY valuepublic void setErrInfo(Map errInfo)
errInfo - ERROR_KEY valueErrInfopublic ErrInfo getErrInfo()
ERROR_KEY value as an ErrInfopublic boolean isOK()
getStatus()==OK_STATUSpublic void check()
SampMapSampUtils.checkMap(java.util.Map) (ensuring that all keys
are Strings, and all values Strings, Lists or Maps), subclass-specific
invariants may be checked. In the case that there's something wrong,
an informative DataException will be thrown.
check in class SampMappublic static Response createSuccessResponse(Map result)
result - key-value map representing results of successful call
public static Response createErrorResponse(ErrInfo errinfo)
errinfo - error information
public static Response asResponse(Map map)
map - map
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||