Skip to content

Commit cec0011

Browse files
authored
Merge pull request #181 from avaje/feature/javadoc-improve
Improve Javadoc only
2 parents 1452cae + d0e16c5 commit cec0011

File tree

9 files changed

+57
-40
lines changed

9 files changed

+57
-40
lines changed

http-client/src/main/java/io/avaje/http/client/DHttpApi.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,19 +41,19 @@ private <T> HttpApiProvider<T> lookup(Class<T> type) {
4141
}
4242

4343
@SuppressWarnings("unchecked")
44-
<T> T provideFor(Class<T> type, HttpClient clientContext) {
44+
<T> T provideFor(Class<T> type, HttpClient httpClient) {
4545
final HttpApiProvider<T> apiProvider = lookup(type);
4646
if (apiProvider == null) {
4747
throw new IllegalArgumentException("No registered HttpApiProvider for type: " + type);
4848
}
49-
return apiProvider.provide(clientContext);
49+
return apiProvider.provide(httpClient);
5050
}
5151

5252
/**
5353
* Return the client implementation via service loading.
5454
*/
55-
static <T> T provide(Class<T> type, HttpClient clientContext) {
56-
return INSTANCE.provideFor(type, clientContext);
55+
static <T> T provide(Class<T> type, HttpClient httpClient) {
56+
return INSTANCE.provideFor(type, httpClient);
5757
}
5858

5959
/**

http-client/src/main/java/io/avaje/http/client/HttpAsyncResponse.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
* <h4>Example using .join() for testing purposes</h4>
2121
* <pre>{@code
2222
*
23-
* clientContext.request()
23+
* client.request()
2424
* ...
2525
* .POST().async()
2626
* .bean(HelloDto.class)
@@ -38,7 +38,7 @@
3838
* In this example POST async that will return a bean converted from json response.
3939
* <pre>{@code
4040
*
41-
* clientContext.request()
41+
* client.request()
4242
* ...
4343
* .POST().async()
4444
* .bean(HelloDto.class)
@@ -80,7 +80,7 @@ public interface HttpAsyncResponse {
8080
*
8181
* <pre>{@code
8282
*
83-
* clientContext.request()
83+
* client.request()
8484
* .path("hello/world")
8585
* .GET()
8686
* .async().asVoid()
@@ -115,7 +115,7 @@ public interface HttpAsyncResponse {
115115
*
116116
* <pre>{@code
117117
*
118-
* clientContext.request()
118+
* client.request()
119119
* .path("hello/world")
120120
* .GET()
121121
* .async().asDiscarding()
@@ -140,7 +140,7 @@ public interface HttpAsyncResponse {
140140
*
141141
* <pre>{@code
142142
*
143-
* clientContext.request()
143+
* client.request()
144144
* .path("hello/world")
145145
* .GET()
146146
* .async().asString()
@@ -191,7 +191,7 @@ public interface HttpAsyncResponse {
191191
* </p>
192192
* <pre>{@code
193193
*
194-
* CompletableFuture<HttpResponse<Void>> future = clientContext.request()
194+
* CompletableFuture<HttpResponse<Void>> future = client.request()
195195
* .path("hello/lineStream")
196196
* .GET().async()
197197
* .handler(HttpResponse.BodyHandlers.fromLineSubscriber(new Flow.Subscriber<>() {
@@ -240,7 +240,7 @@ default <E> CompletableFuture<HttpResponse<E>> withHandler(HttpResponse.BodyHand
240240
*
241241
* <pre>{@code
242242
*
243-
* clientContext.request()
243+
* client.request()
244244
* ...
245245
* .POST().async()
246246
* .as(HelloDto.class)
@@ -280,7 +280,7 @@ default <E> CompletableFuture<HttpResponse<E>> withHandler(HttpResponse.BodyHand
280280
*
281281
* <pre>{@code
282282
*
283-
* clientContext.request()
283+
* client.request()
284284
* ...
285285
* .POST().async()
286286
* .bean(HelloDto.class)
@@ -314,7 +314,7 @@ default <E> CompletableFuture<HttpResponse<E>> withHandler(HttpResponse.BodyHand
314314
*
315315
* <pre>{@code
316316
*
317-
* clientContext.request()
317+
* client.request()
318318
* ...
319319
* .POST().async()
320320
* .asList(HelloDto.class)
@@ -356,7 +356,7 @@ default <E> CompletableFuture<HttpResponse<E>> withHandler(HttpResponse.BodyHand
356356
*
357357
* <pre>{@code
358358
*
359-
* clientContext.request()
359+
* client.request()
360360
* ...
361361
* .GET().async()
362362
* .list(HelloDto.class)
@@ -387,7 +387,7 @@ default <E> CompletableFuture<HttpResponse<E>> withHandler(HttpResponse.BodyHand
387387
*
388388
* <pre>{@code
389389
*
390-
* clientContext.request()
390+
* client.request()
391391
* ...
392392
* .POST().async()
393393
* .asStream(HelloDto.class)

http-client/src/main/java/io/avaje/http/client/HttpCallResponse.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public interface HttpCallResponse {
3232
* <pre>{@code
3333
*
3434
* HttpCall<HttpResponse<Void>> call =
35-
* clientContext.request()
35+
* client.request()
3636
* .path("hello/world")
3737
* .GET()
3838
* .call().asVoid();
@@ -54,7 +54,7 @@ public interface HttpCallResponse {
5454
* <pre>{@code
5555
*
5656
* HttpCall<HttpResponse<Void>> call =
57-
* clientContext.request()
57+
* client.request()
5858
* .path("hello/world")
5959
* .GET()
6060
* .call().asDiscarding();
@@ -71,7 +71,7 @@ public interface HttpCallResponse {
7171
* <pre>{@code
7272
*
7373
* HttpCall<HttpResponse<String>> call =
74-
* clientContext.request()
74+
* client.request()
7575
* .path("hello/world")
7676
* .GET()
7777
* .call().asString();
@@ -107,7 +107,7 @@ public interface HttpCallResponse {
107107
* Call using any given {@code HttpResponse.BodyHandler}.
108108
* <pre>{@code
109109
*
110-
* HttpCall<E> call = clientContext.request()
110+
* HttpCall<E> call = client.request()
111111
* .path("hello/lineStream")
112112
* .GET()
113113
* .call().handler(HttpResponse.BodyHandler<E> ...);

http-client/src/main/java/io/avaje/http/client/HttpClientRequest.java

Lines changed: 31 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@
1919
*
2020
* <pre>{@code
2121
*
22-
* HelloDto dto = clientContext.request()
22+
* HelloDto dto = client.request()
2323
* .path("hello").queryParam("name", "Rob").queryParam("say", "Whats up")
2424
* .GET()
2525
* .bean(HelloDto.class);
2626
*
2727
* }</pre>
2828
*
29-
* @see HttpClientContext
29+
* @see HttpClient
3030
*/
3131
public interface HttpClientRequest {
3232

@@ -113,7 +113,7 @@ public interface HttpClientRequest {
113113
* Add the header to the request implicitly converting the value to a String. If the value is a
114114
* collection then it's values are appended with the same key
115115
*
116-
* @param name The header name
116+
* @param name The header name
117117
* @param value The header value
118118
* @return The request being built
119119
*/
@@ -130,7 +130,7 @@ public interface HttpClientRequest {
130130
/**
131131
* Add the headers to the request via Collection.
132132
*
133-
* @param name The header name
133+
* @param name The header name
134134
* @param value The header values
135135
* @return The request being built
136136
*/
@@ -155,7 +155,7 @@ public interface HttpClientRequest {
155155
* Set the URL to use replacing the base URL.
156156
* <pre>{code
157157
*
158-
* HttpResponse<String> res = clientContext.request()
158+
* HttpResponse<String> res = client.request()
159159
* .url("http://127.0.0.1:8889")
160160
* .path("hello")
161161
* .GET()
@@ -165,7 +165,7 @@ public interface HttpClientRequest {
165165
*
166166
* @param url The url effectively replacing the base url.
167167
* @return The request being built
168-
* @see HttpClientContext.Builder#baseUrl(String)
168+
* @see HttpClient.Builder#baseUrl(String)
169169
*/
170170
HttpClientRequest url(String url);
171171

@@ -248,8 +248,8 @@ public interface HttpClientRequest {
248248
/**
249249
* Add a query parameter with multiple values
250250
*
251-
* @param name The name of the query parameter
252-
* @param value The values of the query parameter which can be null
251+
* @param name The name of the query parameter
252+
* @param values The values of the query parameter which can be null
253253
* @return The request being built
254254
*/
255255
default HttpClientRequest queryParam(String name, Collection<String> values) {
@@ -293,24 +293,41 @@ default HttpClientRequest queryParam(String name, Collection<String> values) {
293293
HttpClientRequest body(Object bean, String contentType);
294294

295295
/**
296-
* Set the body as a bean using the default content type. The default
297-
* content type will often be <code>application/json; charset=utf8</code>.
296+
* Set the body as a bean using the default content type.
297+
* <p>
298+
* The default content type will often be {@code application/json; charset=utf8}.
298299
*/
299300
HttpClientRequest body(Object bean);
300301

301302
/**
302-
* Set the body as a bean with the given content type using a BodyWriter.
303-
* Used for JsonbAdapter
303+
* Set the body as a bean additionally specifying the type that will be
304+
* used to serialise the content (e.g. JsonbAdapter).
305+
* <p>
306+
* Specifying the type allows the bean instance to be a type that extends
307+
* a type that is known to JsonbAdapter / the body content adapter used.
308+
*
309+
* @param bean The body content as an instance
310+
* @param type The type used by the body content adapter to write the body content
311+
* @return The request being built
304312
*/
305313
HttpClientRequest body(Object bean, Class<?> type);
306314

307315
/**
308-
* Set the body as a bean with the given content type using a BodyWriter.
316+
* Set the body as a bean with the given content type and additionally specifying
317+
* the type that will be used to serialise the content (e.g. JsonbAdapter).
318+
* <p>
319+
* Specifying the type allows the bean instance to be a type that extends
320+
* a type that is known to JsonbAdapter / the body content adapter used.
321+
*
322+
* @param bean The body content as an instance
323+
* @param type The type used by the body content adapter to write the body content
324+
* @param contentType The content type of the body
325+
* @return The request being built
309326
*/
310327
HttpClientRequest body(Object bean, Class<?> type, String contentType);
311328

312329
/**
313-
* Set the body content as a string.
330+
* Set the body content as a string using the default content type.
314331
*
315332
* @param body The body content
316333
* @return The request being built

http-client/src/main/java/io/avaje/http/client/HttpClientResponse.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public interface HttpClientResponse {
2121
* In this example POST async that will return a bean converted from json response.
2222
* <pre>{@code
2323
*
24-
* clientContext.request()
24+
* client.request()
2525
* ...
2626
* .POST().async()
2727
* .bean(HelloDto.class)

http-client/src/main/java/io/avaje/http/client/HttpException.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* <pre>{@code
1414
*
1515
* try {
16-
* clientContext.request()
16+
* client.request()
1717
* .path("hello/saveForm")
1818
* .formParam("email", "user@foo.com")
1919
* .formParam("url", "notAValidUrl")
@@ -115,7 +115,7 @@ public String bodyAsString() {
115115
return new String(body.content(), StandardCharsets.UTF_8);
116116
}
117117

118-
/**
118+
/**
119119
* Return the response body content as raw bytes, or else null if body content doesn't exist.
120120
*/
121121
public byte[] bodyAsBytes() {

http-client/src/main/java/io/avaje/http/client/JacksonBodyAdapter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*
1616
* <pre>{@code
1717
*
18-
* HttpClientContext.builder()
18+
* HttpClient.builder()
1919
* .baseUrl(baseUrl)
2020
* .bodyAdapter(new JacksonBodyAdapter())
2121
* .build();

http-client/src/main/java/io/avaje/http/client/JsonbBodyAdapter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
*
1414
* <pre>{@code
1515
*
16-
* HttpClientContext.builder()
16+
* HttpClient.builder()
1717
* .baseUrl(baseUrl)
1818
* .bodyAdapter(new JsonbBodyAdapter())
1919
* .build();

http-client/src/main/java/io/avaje/http/client/package-info.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
*
77
* <pre>{@code
88
*
9-
* HttpClientContext ctx = HttpClientContext.builder()
9+
* HttpClient client = HttpClient.builder()
1010
* .baseUrl("http://localhost:8080")
1111
* .bodyAdapter(new JacksonBodyAdapter())
1212
* .build();
1313
*
14-
* HelloDto dto = ctx.request()
14+
* HelloDto dto = client.request()
1515
* .path("hello")
1616
* .queryParam("say", "Whats up")
1717
* .GET()

0 commit comments

Comments
 (0)