doum
6 天以前 2b287056e2f59518888d05a1bbc7e5a55fbd84d5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
package com.doumee.lib_coremodel.http;
 
 
/**
 * @author <a href="mailto:jenly1314@gmail.com">Jenly</a>
 */
public class InterceptorConfig {
 
    private boolean isAddLog;
 
    private boolean isAddGsonConverterFactory;
 
    private InterceptorConfig(Builder builder) {
        isAddLog = builder.isAddLog;
        isAddGsonConverterFactory = builder.isAddGsonConverterFactory;
    }
 
    /**
     * 是否添加 支持打印 Http 相关日志
     */
    public boolean isAddLog() {
        return isAddLog;
    }
 
    /**
     * 是否添加 支持 Gson 转换工厂
     */
    public boolean isAddGsonConverterFactory() {
        return isAddGsonConverterFactory;
    }
 
    public static Builder newBuilder() {
        return new Builder();
    }
 
    public static final class Builder {
        private boolean isAddLog = true;
        private boolean isAddGsonConverterFactory = true;
 
        private Builder() {
        }
 
        /**
         * 是否添加 支持打印 Http 相关日志
         * @param addLog
         * @return
         */
        public Builder addLog(boolean addLog) {
            this.isAddLog = addLog;
            return this;
        }
 
        /**
         *  是否添加 支持 Gson 转换工厂
         * @param addGsonConverterFactory
         * @return
         */
        public Builder addGsonConverterFactory(boolean addGsonConverterFactory) {
            isAddGsonConverterFactory = addGsonConverterFactory;
            return this;
        }
 
        public InterceptorConfig build() {
            return new InterceptorConfig(this);
        }
    }
}