public class APIResponse extends Object
Modifier and Type | Field and Description |
---|---|
static int |
ERROR_CODE_INVALID_CONTENT |
static String |
STATUS_ERROR |
static String |
STATUS_OK |
Constructor and Description |
---|
APIResponse() |
Modifier and Type | Method and Description |
---|---|
APIResponseData |
getData()
Get the response data.
|
int |
getErrorCode() |
String |
getErrorMessage() |
String |
getStatus() |
boolean |
hasData() |
boolean |
hasError()
Check whether the response status is OK (= STATUS_OK) or not.
|
boolean |
ok()
Check whether the response status is OK (= STATUS_OK) or not.
|
void |
setError(int errorCode,
String errorMessage)
Set as a error response.
|
void |
setErrorCode(int errorEode)
Set error code.
|
void |
setErrorMessage(String errorMessage)
Set error message.
|
void |
setInvalid(String message)
Set as a invalid response.
|
void |
setJsonStringSource(String jsonString)
Set the original JSON string.
|
void |
setStatus(String status)
Set status value.
|
String |
toString() |
public static final String STATUS_OK
public static final String STATUS_ERROR
public static final int ERROR_CODE_INVALID_CONTENT
public void setJsonStringSource(String jsonString)
jsonString
- - The original JSON string.public void setInvalid(String message)
message
- - Error message to explain why this is an invalid result.public void setError(int errorCode, String errorMessage)
errorCode
- - The error code.errorMessage
- - Error message.public boolean ok()
public boolean hasError()
public String getStatus()
public void setStatus(String status)
status
- - Status value string.public int getErrorCode()
public void setErrorCode(int errorEode)
errorEode
- - Error code.public String getErrorMessage()
public void setErrorMessage(String errorMessage)
errorMessage
- - Error message.public APIResponseData getData()
public boolean hasData()
Copyright © 2018. All rights reserved.