aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFicus Kirkpatrick <ficus@android.com>2014-02-08 23:31:38 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2014-02-08 23:31:38 +0000
commit4a6d3f5ee11e7df0ca7760d895213739dbf084ff (patch)
treef62e9b89e28ba7b347cbfc76b0c53398003fcc53 /src
parent6358cb0819f8bae7bfc6ac492721ca3015956c6b (diff)
parente3280b4e47cf6fcc6b4e132baecbd15d7d6f8c19 (diff)
downloadvolley-4a6d3f5ee11e7df0ca7760d895213739dbf084ff.tar.gz
Merge "Allow method chaining on setters"
Diffstat (limited to 'src')
-rw-r--r--src/com/android/volley/Request.java35
1 files changed, 29 insertions, 6 deletions
diff --git a/src/com/android/volley/Request.java b/src/com/android/volley/Request.java
index 28fb5f9..0e5912f 100644
--- a/src/com/android/volley/Request.java
+++ b/src/com/android/volley/Request.java
@@ -117,6 +117,7 @@ public abstract class Request<T> implements Comparable<Request<T>> {
*
* @deprecated Use {@link #Request(int, String, com.android.volley.Response.ErrorListener)}.
*/
+ @Deprecated
public Request(String url, Response.ErrorListener listener) {
this(Method.DEPRECATED_GET_OR_POST, url, listener);
}
@@ -146,9 +147,12 @@ public abstract class Request<T> implements Comparable<Request<T>> {
/**
* Set a tag on this request. Can be used to cancel all requests with this
* tag by {@link RequestQueue#cancelAll(Object)}.
+ *
+ * @return This Request object to allow for chaining.
*/
- public void setTag(Object tag) {
+ public Request<?> setTag(Object tag) {
mTag = tag;
+ return this;
}
/**
@@ -168,9 +172,12 @@ public abstract class Request<T> implements Comparable<Request<T>> {
/**
* Sets the retry policy for this request.
+ *
+ * @return This Request object to allow for chaining.
*/
- public void setRetryPolicy(RetryPolicy retryPolicy) {
+ public Request<?> setRetryPolicy(RetryPolicy retryPolicy) {
mRetryPolicy = retryPolicy;
+ return this;
}
/**
@@ -222,16 +229,22 @@ public abstract class Request<T> implements Comparable<Request<T>> {
/**
* Associates this request with the given queue. The request queue will be notified when this
* request has finished.
+ *
+ * @return This Request object to allow for chaining.
*/
- public void setRequestQueue(RequestQueue requestQueue) {
+ public Request<?> setRequestQueue(RequestQueue requestQueue) {
mRequestQueue = requestQueue;
+ return this;
}
/**
* Sets the sequence number of this request. Used by {@link RequestQueue}.
+ *
+ * @return This Request object to allow for chaining.
*/
- public final void setSequence(int sequence) {
+ public final Request<?> setSequence(int sequence) {
mSequence = sequence;
+ return this;
}
/**
@@ -261,9 +274,12 @@ public abstract class Request<T> implements Comparable<Request<T>> {
/**
* Annotates this request with an entry retrieved for it from cache.
* Used for cache coherency support.
+ *
+ * @return This Request object to allow for chaining.
*/
- public void setCacheEntry(Cache.Entry entry) {
+ public Request<?> setCacheEntry(Cache.Entry entry) {
mCacheEntry = entry;
+ return this;
}
/**
@@ -308,6 +324,7 @@ public abstract class Request<T> implements Comparable<Request<T>> {
*
* @deprecated Use {@link #getParams()} instead.
*/
+ @Deprecated
protected Map<String, String> getPostParams() throws AuthFailureError {
return getParams();
}
@@ -326,6 +343,7 @@ public abstract class Request<T> implements Comparable<Request<T>> {
*
* @deprecated Use {@link #getParamsEncoding()} instead.
*/
+ @Deprecated
protected String getPostParamsEncoding() {
return getParamsEncoding();
}
@@ -333,6 +351,7 @@ public abstract class Request<T> implements Comparable<Request<T>> {
/**
* @deprecated Use {@link #getBodyContentType()} instead.
*/
+ @Deprecated
public String getPostBodyContentType() {
return getBodyContentType();
}
@@ -344,6 +363,7 @@ public abstract class Request<T> implements Comparable<Request<T>> {
*
* @deprecated Use {@link #getBody()} instead.
*/
+ @Deprecated
public byte[] getPostBody() throws AuthFailureError {
// Note: For compatibility with legacy clients of volley, this implementation must remain
// here instead of simply calling the getBody() function because this function must
@@ -421,9 +441,12 @@ public abstract class Request<T> implements Comparable<Request<T>> {
/**
* Set whether or not responses to this request should be cached.
+ *
+ * @return This Request object to allow for chaining.
*/
- public final void setShouldCache(boolean shouldCache) {
+ public final Request<?> setShouldCache(boolean shouldCache) {
mShouldCache = shouldCache;
+ return this;
}
/**