Back to project page cube-sdk.
The source code is released under:
Apache License
If you think the Android project cube-sdk listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package in.srain.cube.request; //from w w w . j a va 2 s . c om public abstract class RequestBase<T> implements IRequest<T> { private RequestData mRequestData = new RequestData(); private boolean mHasBeenCanceled = false; public RequestData getRequestData() { return mRequestData; } @Override public void send() { prepareRequest(); doSendRequest(); } @Override public void cancelRequest() { mHasBeenCanceled = true; onCancel(); } @Override public T onDataFromServer(String data) { JsonData jsonData = JsonData.create(data); return processOriginDataFromServer(jsonData); } protected boolean hasBeenCanceled() { return mHasBeenCanceled; } protected void onCancel() { } /** * implement this method to process request data */ protected abstract void doSendRequest(); /** * prepare request */ protected abstract void prepareRequest(); }