/
SDKConfig.java
executable file
·167 lines (152 loc) · 3.87 KB
/
SDKConfig.java
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
package com.zoho.crm.api;
/**
* The class to configure the SDK.
*/
public class SDKConfig
{
/**
* The Builder class to build SDKConfig
*/
public static class Builder
{
private boolean autoRefreshFields = false;
private boolean pickListValidation = true;
private int connectionTimeout = 0;
private int requestTimeout = 0;
private int socketTimeout = 0;
public Builder()
{
}
/**
* This is a setter method to set autoRefreshFields.
*
* @param autoRefreshFields A boolean
* @return An instance of Builder
*/
public Builder autoRefreshFields(boolean autoRefreshFields)
{
this.autoRefreshFields = autoRefreshFields;
return this;
}
/**
* This is a setter method to set pickListValidation.
*
* @param pickListValidation A boolean
* @return An instance of Builder
*/
public Builder pickListValidation(boolean pickListValidation)
{
this.pickListValidation = pickListValidation;
return this;
}
/**
* This is a setter method to set connectionTimeout.
*
* @param connectionTimeout A int
* @return An instance of Builder
*/
public Builder connectionTimeout(int connectionTimeout)
{
this.connectionTimeout = connectionTimeout > 0 ? connectionTimeout : 0;
return this;
}
/**
* This is a setter method to set requestTimeout.
*
* @param requestTimeout A int
* @return An instance of Builder
*/
public Builder requestTimeout(int requestTimeout)
{
this.requestTimeout = requestTimeout > 0 ? requestTimeout : 0;
return this;
}
/**
* This is a setter method to set socketTimeout.
*
* @param socketTimeout A int
* @return An instance of Builder
*/
public Builder socketTimeout(int socketTimeout)
{
this.socketTimeout = socketTimeout > 0 ? socketTimeout : 0;
return this;
}
/**
* The method to build the SDKConfig instance
*
* @return An instance of SDKConfig
*/
public SDKConfig build()
{
return new SDKConfig(autoRefreshFields, pickListValidation, connectionTimeout, requestTimeout, socketTimeout);
}
}
private boolean autoRefreshFields;
private boolean pickListValidation;
private int connectionTimeout;
private int requestTimeout;
private int socketTimeout;
/**
* Creates an instance of SDKConfig with the given parameters
*
* @param autoRefreshFields A boolean representing autoRefreshFields
* @param pickListValidation A boolean representing pickListValidation
* @param connectionTimeout A long representing connectionTimeout
* @param requestTimeout A long representing requestTimeout
* @param socketTimeout A long representing socketTimeout
*/
private SDKConfig(boolean autoRefreshFields, boolean pickListValidation, int connectionTimeout, int requestTimeout, int socketTimeout)
{
this.autoRefreshFields = autoRefreshFields;
this.pickListValidation = pickListValidation;
this.connectionTimeout = connectionTimeout;
this.requestTimeout = requestTimeout;
this.socketTimeout = socketTimeout;
}
/**
* This is a getter method to get autoRefreshFields.
*
* @return A boolean representing autoRefreshFields
*/
public boolean getAutoRefreshFields()
{
return autoRefreshFields;
}
/**
* This is a getter method to get pickListValidation.
*
* @return A boolean representing pickListValidation
*/
public boolean getPickListValidation()
{
return pickListValidation;
}
/**
* This is a getter method to get connectionTimeout.
*
* @return A int representing connectionTimeout
*/
public int getConnectionTimeout()
{
return connectionTimeout;
}
/**
* This is a getter method to get requestTimeout.
*
* @return A int representing requestTimeout
*/
public int getRequestTimeout()
{
return requestTimeout;
}
/**
* This is a getter method to get socketTimeout.
*
* @return A int representing socketTimeout
*/
public int getSocketTimeout()
{
return socketTimeout;
}
}