Android Open Source - yshi-cursor Abstract Request Processor






From Project

Back to project page yshi-cursor.

License

The source code is released under:

MIT License

If you think the Android project yshi-cursor listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package org.yshi.cursor;
/*from ww  w. jav  a2 s .c o  m*/
import com.android.volley.AuthFailureError;
import com.android.volley.Request;
import com.android.volley.Response;

import java.util.Map;
import java.util.TreeMap;

/**
 * Created by sell on 06/04/14.
 */
abstract public class AbstractRequestProcessor<ItemType> extends Request<CursorCollection<ItemType>> {

    public final CursorState<ItemType> m_state;
    public final Response.Listener<CursorCollection<ItemType>> m_callback;

    public AbstractRequestProcessor(CursorState<ItemType> state, String url,
                                   Response.Listener<CursorCollection<ItemType>> callback,
                                   Response.ErrorListener errback
    ) {
        super(Method.GET, url, errback);
        m_callback = callback;
        m_state = state;
    }

    protected CursorState<ItemType> getState() {
        return m_state;
    }

    @Override
    protected void deliverResponse(CursorCollection<ItemType> rr) {
        if (m_callback != null)
            m_callback.onResponse(rr);
    }

    abstract protected Class<ItemType> getResponseType();

    @Override
    public Map<String, String> getHeaders() throws AuthFailureError {
        return new TreeMap<String, String>(m_state.getHeaders());
    }
}




Java Source Code List

org.yshi.cursor.AbstractRequestProcessor.java
org.yshi.cursor.AlreadyRequesting.java
org.yshi.cursor.BackedCollection.java
org.yshi.cursor.ContinuedCursorRequestProcessor.java
org.yshi.cursor.CursorCollection.java
org.yshi.cursor.CursorState.java
org.yshi.cursor.GsonManager.java
org.yshi.cursor.InitialRequestProcessor.java
org.yshi.cursor.TerminalCollection.java