vip.ipav.okhttp.builder.OkHttpRequestBuilderHasParam Maven / Gradle / Ivy
package vip.ipav.okhttp.builder;
import vip.ipav.okhttp.OkHttpClientTools;
import java.util.LinkedHashMap;
import java.util.Map;
@SuppressWarnings("unchecked")
public abstract class OkHttpRequestBuilderHasParam extends OkHttpRequestBuilder {
protected Map mParams;
public OkHttpRequestBuilderHasParam(OkHttpClientTools okHttpClientTools) {
super(okHttpClientTools);
}
/**
* set Map params
* @param params
* @return
*/
public T params(Map params) {
this.mParams = params;
return (T) this;
}
/**
* add param
* @param key param key
* @param val param val
* @return
*/
public T addParam(String key, String val) {
if (this.mParams == null)
{
mParams = new LinkedHashMap<>();
}
mParams.put(key, val);
return (T) this;
}
}