@946898963
2018-05-18T11:28:48.000000Z
字数 741
阅读 1035
Android控件跟框架
Android源码分析
public class Response<T> {
public interface Listener<T> {
public void onResponse(T response);
}
public interface ErrorListener {
public void onErrorResponse(VolleyError error);
}
public final T result;
public final Cache.Entry cacheEntry;
public final VolleyError error;
public boolean intermediate = false;
public boolean isSuccess() {
return error == null;
}
private Response(T result, Cache.Entry cacheEntry) {
this.result = result;
this.cacheEntry = cacheEntry;
this.error = null;
}
private Response(VolleyError error) {
this.result = null;
this.cacheEntry = null;
this.error = error;
}
public static <T> Response<T> success(T result, Cache.Entry cacheEntry) {
return new Response<T>(result, cacheEntry);
}
public static <T> Response<T> error(VolleyError error) {
return new Response<T>(error);
}
}