package com.demo.lib.common.okhttp.builder; import com.demo.lib.common.okhttp.request.RequestCall; import java.util.LinkedHashMap; import java.util.Map; /** * Created by zhy on 15/12/14. */ public abstract class OkHttpRequestBuilder { protected String url; protected Object tag; protected Map headers; protected Map params; protected int id; public T id(int id) { this.id = id; return (T) this; } public T url(String url) { this.url = url; return (T) this; } public T tag(Object tag) { this.tag = tag; return (T) this; } public T headers(Map headers) { this.headers = headers; return (T) this; } public T addHeader(String key, String val) { if (this.headers == null) { headers = new LinkedHashMap<>(); } headers.put(key, val); return (T) this; } public abstract RequestCall build(); }