Skip to content

Commit 7aaf159

Browse files
committedMay 15, 2014
Add "has" method, to check parameter existence.
Can be useful since the real parameters map is protected.
1 parent 1bdde80 commit 7aaf159

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed
 

‎library/src/main/java/com/loopj/android/http/RequestParams.java

+13
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,19 @@ public void remove(String key) {
326326
urlParamsWithObjects.remove(key);
327327
}
328328

329+
/**
330+
* Check if a parameter is defined.
331+
*
332+
* @param key the key name for the parameter to check existence.
333+
* @return Boolean
334+
*/
335+
public Boolean has(String key) {
336+
return urlParams.get(key) != null ||
337+
streamParams.get(key) != null ||
338+
fileParams.get(key) != null ||
339+
urlParamsWithObjects.get(key) != null;
340+
}
341+
329342
@Override
330343
public String toString() {
331344
StringBuilder result = new StringBuilder();

0 commit comments

Comments
 (0)
Please sign in to comment.