// Path: architecture/src/main/java/com/jiang/android/architecture/okhttp/cookie/store/CookieStore.java
// public interface CookieStore
// {
// 
//     public  void add(HttpUrl uri, List<Cookie> cookie);
// 
//     public  List<Cookie> get(HttpUrl uri);
// 
//     public  List<Cookie> getCookies();
// 
//     public  boolean remove(HttpUrl uri, Cookie cookie);
// 
//     public boolean removeAll();
// 
// 
// }
// 
// Path: architecture/src/main/java/com/jiang/android/architecture/okhttp/cookie/store/HasCookieStore.java
// public interface HasCookieStore
// {
//     CookieStore getCookieStore();
// }
// 
// Path: architecture/src/main/java/com/jiang/android/architecture/okhttp/exception/Exceptions.java
// public class Exceptions
// {
//     public static void illegalArgument(String msg, Object... params)
//     {
//         throw new IllegalArgumentException(String.format(msg, params));
//     }
// 
// 
// }


import com.jiang.android.architecture.okhttp.cookie.store.CookieStore;
import com.jiang.android.architecture.okhttp.cookie.store.HasCookieStore;
import com.jiang.android.architecture.okhttp.exception.Exceptions;
import java.util.List;
import okhttp3.Cookie;
import okhttp3.CookieJar;
import okhttp3.HttpUrl;
package com.jiang.android.architecture.okhttp.cookie;




/**
 * Created by zhy on 16/3/10.
 */
public class CookieJarImpl implements CookieJar, HasCookieStore
{
    private CookieStore cookieStore;

    public CookieJarImpl(CookieStore cookieStore)
    {
        if (cookieStore == null) Exceptions.illegalArgument("cookieStore can not be null.");
        this.cookieStore = cookieStore;
    }

    @Override
    public synchronized void saveFromResponse(HttpUrl url, List<Cookie> cookies)
    {
        cookieStore.add(url, cookies);
    }

    @Override
    public synchronized List<Cookie> loadForRequest(HttpUrl url)
    {
        return cookieStore.get(url);
    }

// Path: architecture/src/main/java/com/jiang/android/architecture/okhttp/cookie/store/CookieStore.java
// public interface CookieStore
// {
// 
//     public  void add(HttpUrl uri, List<Cookie> cookie);
// 
//     public  List<Cookie> get(HttpUrl uri);
// 
//     public  List<Cookie> getCookies();
// 
//     public  boolean remove(HttpUrl uri, Cookie cookie);
// 
//     public boolean removeAll();
// 
// 
// }
// 
// Path: architecture/src/main/java/com/jiang/android/architecture/okhttp/cookie/store/HasCookieStore.java
// public interface HasCookieStore
// {
//     CookieStore getCookieStore();
// }
// 
// Path: architecture/src/main/java/com/jiang/android/architecture/okhttp/exception/Exceptions.java
// public class Exceptions
// {
//     public static void illegalArgument(String msg, Object... params)
//     {
//         throw new IllegalArgumentException(String.format(msg, params));
//     }
// 
// 
// }


// Path: architecture/src/main/java/com/jiang/android/architecture/okhttp/cookie/CookieJarImpl.java
import com.jiang.android.architecture.okhttp.cookie.store.CookieStore;
import com.jiang.android.architecture.okhttp.cookie.store.HasCookieStore;
import com.jiang.android.architecture.okhttp.exception.Exceptions;
import java.util.List;
import okhttp3.Cookie;
import okhttp3.CookieJar;
import okhttp3.HttpUrl;

package com.jiang.android.architecture.okhttp.cookie;




/**
 * Created by zhy on 16/3/10.
 */
public class CookieJarImpl implements CookieJar, HasCookieStore
{
    private CookieStore cookieStore;

    public CookieJarImpl(CookieStore cookieStore)
    {
        if (cookieStore == null) Exceptions.illegalArgument("cookieStore can not be null.");
        this.cookieStore = cookieStore;
    }

    @Override
    public synchronized void saveFromResponse(HttpUrl url, List<Cookie> cookies)
    {
        cookieStore.add(url, cookies);
    }

    @Override
    public synchronized List<Cookie> loadForRequest(HttpUrl url)
    {
        return cookieStore.get(url);
    }

    @Override