Skip to content

Commit 4e35125

Browse files
committed
fix javadoc
1 parent f982fbf commit 4e35125

2 files changed

Lines changed: 2 additions & 112 deletions

File tree

‎okhttps/src/main/java/com/ejlchina/okhttps/HTTP.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ interface Builder {
173173
Executor mainExecutor();
174174

175175
/**
176-
* 配置 任务调度器,可用的调度由 {@link WebSocketTask#heatbeat(int, int) } 指定的心跳任务
176+
* 配置 任务调度器,可用的调度由 {@link WHttpTask#heatbeat(int, int) } 指定的心跳任务
177177
* 若不配置,则生成一个 线程容量为 1 的 ScheduledThreadPoolExecutor 调度器
178178
* @since v2.3.0
179179
* @param scheduler 调度器

‎okhttps/src/main/java/com/ejlchina/okhttps/okhttp/OkHttpBuilderImpl.java‎

Lines changed: 1 addition & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -97,241 +97,131 @@ public OkHttpBuilderImpl(OkHttpClientWrapper hc) {
9797
charset = hc.charset();
9898
}
9999

100-
/**
101-
* 自 v3.2.0 后可以多次调用
102-
* 配置 OkHttpClient
103-
* @param config 配置器
104-
* @return Builder
105-
*/
100+
106101
public HTTP.Builder config(HTTP.OkConfig config) {
107102
if (config != null) {
108103
configs.add(config);
109104
}
110105
return this;
111106
}
112107

113-
/**
114-
* 设置 baseUrl
115-
* @param baseUrl 全局URL前缀
116-
* @return Builder
117-
*/
118108
public HTTP.Builder baseUrl(String baseUrl) {
119109
if (baseUrl != null) {
120110
this.baseUrl = baseUrl.trim();
121111
}
122112
return this;
123113
}
124114

125-
/**
126-
* 配置媒体类型
127-
* @param mediaTypes 媒体类型
128-
* @return Builder
129-
*/
130115
public HTTP.Builder mediaTypes(Map<String, String> mediaTypes) {
131116
if (mediaTypes != null) {
132117
this.mediaTypes.putAll(mediaTypes);
133118
}
134119
return this;
135120
}
136121

137-
/**
138-
* 配置媒体类型
139-
* @param key 媒体类型KEY
140-
* @param value 媒体类型VALUE
141-
* @return Builder
142-
*/
143122
public HTTP.Builder mediaTypes(String key, String value) {
144123
if (key != null && value != null) {
145124
this.mediaTypes.put(key, value);
146125
}
147126
return this;
148127
}
149128

150-
/**
151-
* 配置支持的报文体类型
152-
* @param contentTypes 报文体类型列表
153-
* @return Builder
154-
*/
155129
public HTTP.Builder contentTypes(List<String> contentTypes) {
156130
if (contentTypes != null) {
157131
this.contentTypes.addAll(contentTypes);
158132
}
159133
return this;
160134
}
161135

162-
/**
163-
* 配置支持的报文体类型
164-
* @param contentType 报文体类型
165-
* @return Builder
166-
*/
167136
public HTTP.Builder contentTypes(String contentType) {
168137
if (contentType != null) {
169138
this.contentTypes.add(contentType);
170139
}
171140
return this;
172141
}
173142

174-
/**
175-
* 设置回调执行器,例如实现切换线程功能,只对异步请求有效
176-
* @param executor 回调执行器
177-
* @return Builder
178-
*/
179143
public HTTP.Builder callbackExecutor(Executor executor) {
180144
this.mainExecutor = executor;
181145
return this;
182146
}
183147

184-
/**
185-
* 配置 任务调度器,可用的调度由 {@link WebSocketTask#heatbeat(int, int) } 指定的心跳任务
186-
* 若不配置,则生成一个 线程容量为 1 的 ScheduledThreadPoolExecutor 调度器
187-
* @since v2.3.0
188-
* @param scheduler 调度器
189-
* @return Builder
190-
*/
191148
public HTTP.Builder taskScheduler(Scheduler scheduler) {
192149
this.taskScheduler = scheduler;
193150
return this;
194151
}
195152

196-
/**
197-
* 添加可并行处理请求任务的预处理器
198-
* @param preprocessor 预处理器
199-
* @return Builder
200-
*/
201153
public HTTP.Builder addPreprocessor(Preprocessor preprocessor) {
202154
if (preprocessor != null) {
203155
preprocessors.add(preprocessor);
204156
}
205157
return this;
206158
}
207159

208-
/**
209-
* 添加串行预处理器
210-
* @param preprocessor 预处理器
211-
* @return Builder
212-
*/
213160
public HTTP.Builder addSerialPreprocessor(Preprocessor preprocessor) {
214161
if (preprocessor != null) {
215162
preprocessors.add(new SerialPreprocessor(preprocessor));
216163
}
217164
return this;
218165
}
219166

220-
/**
221-
* 清空预处理器(包括串行预处理器)
222-
* @since v2.5.0
223-
* @return Builder
224-
*/
225167
public HTTP.Builder clearPreprocessors() {
226168
preprocessors.clear();
227169
return this;
228170
}
229171

230-
/**
231-
* 最大预处理时间(倍数,相当普通请求的超时时间)
232-
* @param times 普通超时时间的倍数,默认为 10
233-
* @return Builder
234-
*/
235172
public HTTP.Builder preprocTimeoutTimes(int times) {
236173
if (times > 0) {
237174
preprocTimeoutTimes = times;
238175
}
239176
return this;
240177
}
241178

242-
/**
243-
* 设置全局响应监听
244-
* @param listener 监听器
245-
* @return Builder
246-
*/
247179
public HTTP.Builder responseListener(TaskListener<HttpResult> listener) {
248180
responseListener = listener;
249181
return this;
250182
}
251183

252-
/**
253-
* 设置全局异常监听
254-
* @param listener 监听器
255-
* @return Builder
256-
*/
257184
public HTTP.Builder exceptionListener(TaskListener<IOException> listener) {
258185
exceptionListener = listener;
259186
return this;
260187
}
261188

262-
/**
263-
* 设置全局完成监听
264-
* @param listener 监听器
265-
* @return Builder
266-
*/
267189
public HTTP.Builder completeListener(TaskListener<HttpResult.State> listener) {
268190
completeListener = listener;
269191
return this;
270192
}
271193

272-
/**
273-
* 设置下载监听器
274-
* @param listener 监听器
275-
* @return Builder
276-
*/
277194
public HTTP.Builder downloadListener(DownListener listener) {
278195
downloadListener = listener;
279196
return this;
280197
}
281198

282-
/**
283-
* @since v2.0.0
284-
* 添加消息转换器
285-
* @param msgConvertor JSON 服务
286-
* @return Builder
287-
*/
288199
public HTTP.Builder addMsgConvertor(MsgConvertor msgConvertor) {
289200
if (msgConvertor != null) {
290201
msgConvertors.add(msgConvertor);
291202
}
292203
return this;
293204
}
294205

295-
/**
296-
* 清空消息转换器
297-
* @since v2.5.0
298-
* @return Builder
299-
*/
300206
public HTTP.Builder clearMsgConvertors() {
301207
msgConvertors.clear();
302208
return this;
303209
}
304210

305-
/**
306-
* @since v2.0.0
307-
* 设置默认编码格式
308-
* @param charset 编码
309-
* @return Builder
310-
*/
311211
public HTTP.Builder charset(Charset charset) {
312212
if (charset != null) {
313213
this.charset = charset;
314214
}
315215
return this;
316216
}
317217

318-
/**
319-
* @since v2.0.0
320-
* 设置默认请求体类型
321-
* @param bodyType 请求体类型
322-
* @return Builder
323-
*/
324218
public HTTP.Builder bodyType(String bodyType) {
325219
if (bodyType != null) {
326220
this.bodyType = bodyType.toLowerCase();
327221
}
328222
return this;
329223
}
330224

331-
/**
332-
* 构建 HTTP 实例
333-
* @return HTTP
334-
*/
335225
public HTTP build() {
336226
if (configs.size() > 0 || okClient == null) {
337227
OkHttpClient.Builder builder;

0 commit comments

Comments
 (0)