@ThreadSafe @Immutable @LevelUpApi(contract=PUBLIC) public final class LevelUpResponse extends BufferedResponse implements Parcelable
Parcelable.ClassLoaderCreator<T>, Parcelable.Creator<T>
Modifier and Type | Field and Description |
---|---|
static Parcelable.Creator<LevelUpResponse> |
CREATOR
Creator for parceling.
|
CONTENTS_FILE_DESCRIPTOR, PARCELABLE_WRITE_RETURN_VALUE
Constructor and Description |
---|
LevelUpResponse(LevelUpStatus status,
LevelUpResponse originalResponse) |
LevelUpResponse(Parcel in)
Constructor for parceling.
|
LevelUpResponse(String data,
LevelUpStatus status) |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
Exception |
getError()
Get the error that occurred during the sending of the request OR during the reading of the
response.
|
Error |
getServerError(ErrorObject object,
ErrorCode code)
Get a specific
Error from the LevelUpResponse which contains specific values
for Error.getObject() and Error.getCode() . |
List<Error> |
getServerErrors() |
LevelUpStatus |
getStatus() |
int |
hashCode() |
boolean |
hasServerErrors() |
String |
toString() |
void |
writeToParcel(Parcel dest,
int flags) |
describeContents, getData
getHttpHeader, getHttpHeaders, getHttpStatusCode
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
describeContents
public static final Parcelable.Creator<LevelUpResponse> CREATOR
public LevelUpResponse(String data, LevelUpStatus status)
data
- the string data (typically JSON) from the response from the server.status
- the status of the response. See LevelUpStatus
.public LevelUpResponse(LevelUpStatus status, LevelUpResponse originalResponse)
status
- the status of the response. See LevelUpStatus
.originalResponse
- the original response the server gavepublic LevelUpResponse(Parcel in)
in
- the parcel to read from.public LevelUpStatus getStatus()
LevelUpStatus
for this LevelUpResponse.public List<Error> getServerErrors()
Error
s on this server response. Will attempt to parse the
Error
s from the BufferedResponse.getData()
if the errors are not already populated.public boolean hasServerErrors()
public Error getServerError(ErrorObject object, ErrorCode code)
Error
from the LevelUpResponse
which contains specific values
for Error.getObject()
and Error.getCode()
.object
- the ErrorObject
of the desired error. This object is scoped to the
context of the web service.code
- the ErrorCode
of the desired error.Error
or null if the error is not found.public Exception getError()
BufferedResponse
getError
in class BufferedResponse
public String toString()
toString
in class BufferedResponse
public void writeToParcel(Parcel dest, int flags)
writeToParcel
in interface Parcelable
writeToParcel
in class BufferedResponse