com.sponsorpay.sdk.android.publisher.currency
Class CurrencyServerAbstractResponse

java.lang.Object
  extended by com.sponsorpay.sdk.android.publisher.AbstractResponse
      extended by com.sponsorpay.sdk.android.publisher.currency.CurrencyServerAbstractResponse
Direct Known Subclasses:
CurrencyServerDeltaOfCoinsResponse, RequestErrorResponse

public abstract class CurrencyServerAbstractResponse
extends AbstractResponse

Encloses a basic response received from the SponsorPay's Virtual Currency Server and methods to perform parsing of the returned JSON-encoded data.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.sponsorpay.sdk.android.publisher.AbstractResponse
AbstractResponse.RequestErrorType
 
Field Summary
protected  SPCurrencyServerListener mListener
          Listener which will be notified after parsing the response.
 
Fields inherited from class com.sponsorpay.sdk.android.publisher.AbstractResponse
ERROR_CODE_KEY, ERROR_MESSAGE_KEY, mErrorCode, mErrorMessage, mErrorType, mResponseBody, mResponseSignature, mResponseStatusCode
 
Constructor Summary
CurrencyServerAbstractResponse()
           
 
Method Summary
static CurrencyServerAbstractResponse getParsingInstance(VirtualCurrencyConnector.RequestType requestType)
          Returns the appropriate subclass to enclose and parse the response to a request of the passed type.
 void invokeOnErrorCallback()
          Invokes the SPCurrencyServerListener.onSPCurrencyServerError(CurrencyServerAbstractResponse) of the registered callback.
 void setResponseListener(SPCurrencyServerListener listener)
          Set the response listener which will be notified when the parsing is complete.
 
Methods inherited from class com.sponsorpay.sdk.android.publisher.AbstractResponse
getErrorCode, getErrorMessage, getErrorType, hasErrorStatusCode, invokeOnSuccessCallback, parseAndCallListener, parseErrorResponse, parseSuccessfulResponse, setResponseData, verifySignature
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mListener

protected SPCurrencyServerListener mListener
Listener which will be notified after parsing the response. Every response type may call a different listener method.

Constructor Detail

CurrencyServerAbstractResponse

public CurrencyServerAbstractResponse()
Method Detail

setResponseListener

public void setResponseListener(SPCurrencyServerListener listener)
Set the response listener which will be notified when the parsing is complete. Every response type may call a different listener method.

Parameters:
listener -

invokeOnErrorCallback

public void invokeOnErrorCallback()
Invokes the SPCurrencyServerListener.onSPCurrencyServerError(CurrencyServerAbstractResponse) of the registered callback.

Specified by:
invokeOnErrorCallback in class AbstractResponse

getParsingInstance

public static CurrencyServerAbstractResponse getParsingInstance(VirtualCurrencyConnector.RequestType requestType)
Returns the appropriate subclass to enclose and parse the response to a request of the passed type.

Parameters:
requestType - The type of the request whose response can be parsed by the returned instance.
Returns:
An instance of a subclass of CurrencyServerAbstractResponse, or null if no subclass is known for parsing the provided VirtualCurrencyConnector.RequestType.