Skip to content

Commit 4016428

Browse files
garydgregoryok2c
authored andcommitted
Javadoc improvements
- Javadoc: Add missing comments - Javadoc: Add missing tags - Javadoc: Sentences end in a period - Javadoc: Reduce whitespace
1 parent 054fb41 commit 4016428

File tree

13 files changed

+135
-26
lines changed

13 files changed

+135
-26
lines changed

httpcore5-h2/src/main/java/org/apache/hc/core5/http2/ssl/ApplicationProtocol.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,19 @@
3434
*/
3535
public enum ApplicationProtocol {
3636

37-
HTTP_2("h2"), HTTP_1_1("http/1.1");
37+
/**
38+
* The HTTP/2 application protocol.
39+
*/
40+
HTTP_2("h2"),
3841

42+
/**
43+
* The HTTP/1.1 application protocol.
44+
*/
45+
HTTP_1_1("http/1.1");
46+
47+
/**
48+
* The application protocol ID.
49+
*/
3950
public final String id;
4051

4152
ApplicationProtocol(final String id) {

httpcore5/src/main/java/org/apache/hc/core5/annotation/Contract.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,21 @@
3333
import java.lang.annotation.Target;
3434

3535
/**
36-
* This annotation defines behavioral contract enforced at runtime by instances of annotated classes.
36+
* Defines behavioral contract enforced at runtime by instances of annotated classes.
3737
*/
3838
@Documented
3939
@Target(ElementType.TYPE)
4040
@Retention(RetentionPolicy.CLASS)
4141
public @interface Contract {
4242

43+
/**
44+
* Gets the threading behavior for annotated type.
45+
* <p>
46+
* The default value is {@link ThreadingBehavior#UNSAFE}.
47+
* </p>
48+
*
49+
* @return the threading behavior for annotated type.
50+
*/
4351
ThreadingBehavior threading() default ThreadingBehavior.UNSAFE;
4452

4553
}

httpcore5/src/main/java/org/apache/hc/core5/concurrent/BasicFuture.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,11 @@ public class BasicFuture<T> implements Future<T>, Cancellable {
5757
private final ReentrantLock lock;
5858
private final Condition condition;
5959

60+
/**
61+
* Constructs a new instance for a FutureCallback.
62+
*
63+
* @param callback the FutureCallback, may be {@code null}.
64+
*/
6065
public BasicFuture(final FutureCallback<T> callback) {
6166
super();
6267
this.callback = callback;

httpcore5/src/main/java/org/apache/hc/core5/concurrent/CallbackContribution.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
package org.apache.hc.core5.concurrent;
2828

2929
/**
30-
* Convenience base class for {@link FutureCallback}s that contribute a result
30+
* Abstracts implementations of {@link FutureCallback}s that contribute a result
3131
* of the operation to another {@link FutureCallback}.
3232
*
3333
* @param <T> the future result type of an asynchronous operation.
@@ -37,6 +37,11 @@ public abstract class CallbackContribution<T> implements FutureCallback<T> {
3737

3838
private final FutureCallback<?> callback;
3939

40+
/**
41+
* Constructs a new instance for a FutureCallback.
42+
*
43+
* @param callback the FutureCallback, may be {@code null}.
44+
*/
4045
public CallbackContribution(final FutureCallback<?> callback) {
4146
this.callback = callback;
4247
}

httpcore5/src/main/java/org/apache/hc/core5/http/config/Lookup.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@
3636
*/
3737
public interface Lookup<I> {
3838

39+
/**
40+
* Looks up a value using a lower-case string ID.
41+
*
42+
* @param name The lookup name.
43+
* @return The matching value.
44+
*/
3945
I lookup(String name);
4046

4147
}

httpcore5/src/main/java/org/apache/hc/core5/http/config/RegistryBuilder.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@ public final class RegistryBuilder<I> {
4343

4444
private final Map<String, I> items;
4545

46+
/**
47+
* Creates a new RegistryBuilder.
48+
*
49+
* @param <I> the type of Registry values.
50+
* @return a new RegistryBuilder.
51+
*/
4652
public static <I> RegistryBuilder<I> create() {
4753
return new RegistryBuilder<>();
4854
}
@@ -52,13 +58,25 @@ public static <I> RegistryBuilder<I> create() {
5258
this.items = new HashMap<>();
5359
}
5460

61+
/**
62+
* Registers the given item for the given ID.
63+
*
64+
* @param id The ID key, converted to lower-case.
65+
* @param item The item to register.
66+
* @return this instance.
67+
*/
5568
public RegistryBuilder<I> register(final String id, final I item) {
5669
Args.notEmpty(id, "ID");
5770
Args.notNull(item, "Item");
5871
items.put(TextUtils.toLowerCase(id), item);
5972
return this;
6073
}
6174

75+
/**
76+
* Creates a new Registry with the registered items.
77+
*
78+
* @return a new Registry with the registered items.
79+
*/
6280
public Registry<I> build() {
6381
return new Registry<>(items);
6482
}

httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/AsyncServerBootstrap.java

Lines changed: 41 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
import org.apache.hc.core5.http.nio.support.DefaultAsyncResponseExchangeHandlerFactory;
6060
import org.apache.hc.core5.http.nio.support.TerminalAsyncServerFilter;
6161
import org.apache.hc.core5.http.protocol.HttpProcessor;
62+
import org.apache.hc.core5.http.protocol.LookupRegistry;
6263
import org.apache.hc.core5.http.protocol.UriPatternType;
6364
import org.apache.hc.core5.net.InetAddressUtils;
6465
import org.apache.hc.core5.net.URIAuthority;
@@ -99,13 +100,19 @@ private AsyncServerBootstrap() {
99100
this.filters = new ArrayList<>();
100101
}
101102

103+
/**
104+
* Creates a new AsyncServerBootstrap instance.
105+
*
106+
* @return a new AsyncServerBootstrap instance.
107+
*/
102108
public static AsyncServerBootstrap bootstrap() {
103109
return new AsyncServerBootstrap();
104110
}
105111

106112
/**
107113
* Sets canonical name (fully qualified domain name) of the server.
108114
*
115+
* @param canonicalHostName canonical name (fully qualified domain name) of the server.
109116
* @return this instance.
110117
*/
111118
public final AsyncServerBootstrap setCanonicalHostName(final String canonicalHostName) {
@@ -116,6 +123,7 @@ public final AsyncServerBootstrap setCanonicalHostName(final String canonicalHos
116123
/**
117124
* Sets I/O reactor configuration.
118125
*
126+
* @param ioReactorConfig I/O reactor configuration.
119127
* @return this instance.
120128
*/
121129
public final AsyncServerBootstrap setIOReactorConfig(final IOReactorConfig ioReactorConfig) {
@@ -126,6 +134,7 @@ public final AsyncServerBootstrap setIOReactorConfig(final IOReactorConfig ioRea
126134
/**
127135
* Sets HTTP/1.1 protocol parameters.
128136
*
137+
* @param http1Config HTTP/1.1 protocol parameters.
129138
* @return this instance.
130139
*/
131140
public final AsyncServerBootstrap setHttp1Config(final Http1Config http1Config) {
@@ -134,8 +143,9 @@ public final AsyncServerBootstrap setHttp1Config(final Http1Config http1Config)
134143
}
135144

136145
/**
137-
* Sets connection configuration.
146+
* Sets char coding configuration.
138147
*
148+
* @param charCodingConfig char coding configuration.
139149
* @return this instance.
140150
*/
141151
public final AsyncServerBootstrap setCharCodingConfig(final CharCodingConfig charCodingConfig) {
@@ -144,8 +154,9 @@ public final AsyncServerBootstrap setCharCodingConfig(final CharCodingConfig cha
144154
}
145155

146156
/**
147-
* Sets {@link org.apache.hc.core5.http.protocol.HttpProcessor} instance.
157+
* Sets {@link HttpProcessor} instance.
148158
*
159+
* @param httpProcessor {@link HttpProcessor} instance.
149160
* @return this instance.
150161
*/
151162
public final AsyncServerBootstrap setHttpProcessor(final HttpProcessor httpProcessor) {
@@ -154,8 +165,9 @@ public final AsyncServerBootstrap setHttpProcessor(final HttpProcessor httpProce
154165
}
155166

156167
/**
157-
* Sets {@link org.apache.hc.core5.http.ConnectionReuseStrategy} instance.
168+
* Sets {@link ConnectionReuseStrategy} instance.
158169
*
170+
* @param connStrategy {@link ConnectionReuseStrategy} instance.
159171
* @return this instance.
160172
*/
161173
public final AsyncServerBootstrap setConnectionReuseStrategy(final ConnectionReuseStrategy connStrategy) {
@@ -166,6 +178,7 @@ public final AsyncServerBootstrap setConnectionReuseStrategy(final ConnectionReu
166178
/**
167179
* Sets {@link TlsStrategy} instance.
168180
*
181+
* @param tlsStrategy {@link TlsStrategy} instance.
169182
* @return this instance.
170183
*/
171184
public final AsyncServerBootstrap setTlsStrategy(final TlsStrategy tlsStrategy) {
@@ -176,6 +189,7 @@ public final AsyncServerBootstrap setTlsStrategy(final TlsStrategy tlsStrategy)
176189
/**
177190
* Sets TLS handshake {@link Timeout}.
178191
*
192+
* @param handshakeTimeout TLS handshake {@link Timeout}.
179193
* @return this instance.
180194
*/
181195
public final AsyncServerBootstrap setTlsHandshakeTimeout(final Timeout handshakeTimeout) {
@@ -186,6 +200,7 @@ public final AsyncServerBootstrap setTlsHandshakeTimeout(final Timeout handshake
186200
/**
187201
* Sets {@link IOSession} {@link Decorator} instance.
188202
*
203+
* @param ioSessionDecorator {@link IOSession} {@link Decorator} instance.
189204
* @return this instance.
190205
*/
191206
public final AsyncServerBootstrap setIOSessionDecorator(final Decorator<IOSession> ioSessionDecorator) {
@@ -196,6 +211,7 @@ public final AsyncServerBootstrap setIOSessionDecorator(final Decorator<IOSessio
196211
/**
197212
* Sets {@link Exception} {@link Callback} instance.
198213
*
214+
* @param exceptionCallback {@link Exception} {@link Callback} instance.
199215
* @return this instance.
200216
*/
201217
public final AsyncServerBootstrap setExceptionCallback(final Callback<Exception> exceptionCallback) {
@@ -206,6 +222,7 @@ public final AsyncServerBootstrap setExceptionCallback(final Callback<Exception>
206222
/**
207223
* Sets {@link IOSessionListener} instance.
208224
*
225+
* @param sessionListener {@link IOSessionListener} instance.
209226
* @return this instance.
210227
*/
211228
public final AsyncServerBootstrap setIOSessionListener(final IOSessionListener sessionListener) {
@@ -214,18 +231,22 @@ public final AsyncServerBootstrap setIOSessionListener(final IOSessionListener s
214231
}
215232

216233
/**
234+
* Sets a LookupRegistry for Suppliers of AsyncServerExchangeHandler.
235+
*
236+
* @param lookupRegistry LookupRegistry for Suppliers of AsyncServerExchangeHandler.
217237
* @return this instance.
218238
* @deprecated Use {@link RequestRouter}.
219239
*/
220240
@Deprecated
221-
public final AsyncServerBootstrap setLookupRegistry(final org.apache.hc.core5.http.protocol.LookupRegistry<Supplier<AsyncServerExchangeHandler>> lookupRegistry) {
241+
public final AsyncServerBootstrap setLookupRegistry(final LookupRegistry<Supplier<AsyncServerExchangeHandler>> lookupRegistry) {
222242
this.lookupRegistry = lookupRegistry;
223243
return this;
224244
}
225245

226246
/**
227247
* Sets {@link HttpRequestMapper} instance.
228248
*
249+
* @param requestRouter {@link HttpRequestMapper} instance.
229250
* @return this instance.
230251
* @see org.apache.hc.core5.http.impl.routing.RequestRouter
231252
* @since 5.3
@@ -238,6 +259,7 @@ public final AsyncServerBootstrap setRequestRouter(final HttpRequestMapper<Suppl
238259
/**
239260
* Sets {@link Http1StreamListener} instance.
240261
*
262+
* @param streamListener {@link Http1StreamListener} instance.
241263
* @return this instance.
242264
* @since 5.0
243265
*/
@@ -250,8 +272,8 @@ public final AsyncServerBootstrap setStreamListener(final Http1StreamListener st
250272
* Registers the given {@link AsyncServerExchangeHandler} {@link Supplier} as a default handler for URIs
251273
* matching the given pattern.
252274
*
253-
* @param uriPattern the pattern to register the handler for.
254-
* @param supplier the handler supplier.
275+
* @param uriPattern the non-null pattern to register the handler for.
276+
* @param supplier the non-null handler supplier.
255277
* @return this instance.
256278
*/
257279
public final AsyncServerBootstrap register(final String uriPattern, final Supplier<AsyncServerExchangeHandler> supplier) {
@@ -263,11 +285,11 @@ public final AsyncServerBootstrap register(final String uriPattern, final Suppli
263285

264286
/**
265287
* Registers the given {@link AsyncServerExchangeHandler} {@link Supplier} as a handler for URIs
266-
* matching the given host and the pattern.
288+
* matching the given host and pattern.
267289
*
268-
* @param hostname the host name
269-
* @param uriPattern the pattern to register the handler for.
270-
* @param supplier the handler supplier.
290+
* @param hostname the non-null host name.
291+
* @param uriPattern the non-null pattern to register the handler for.
292+
* @param supplier the non-null handler supplier.
271293
* @return this instance.
272294
* @since 5.3
273295
*/
@@ -280,9 +302,14 @@ public final AsyncServerBootstrap register(final String hostname, final String u
280302
}
281303

282304
/**
283-
* @deprecated use {@link #register(String, String, Supplier)}.
305+
* Registers the given {@link AsyncServerExchangeHandler} {@link Supplier} as a handler for URIs
306+
* matching the given host and pattern.
284307
*
308+
* @param hostname the host name.
309+
* @param uriPattern the pattern to register the handler for.
310+
* @param supplier the handler supplier.
285311
* @return this instance.
312+
* @deprecated use {@link #register(String, String, Supplier)}.
286313
*/
287314
@Deprecated
288315
public final AsyncServerBootstrap registerVirtual(final String hostname, final String uriPattern, final Supplier<AsyncServerExchangeHandler> supplier) {
@@ -307,8 +334,9 @@ public final <T> AsyncServerBootstrap register(
307334

308335
/**
309336
* Registers the given {@link AsyncServerRequestHandler} as a handler for URIs
310-
* matching the given host and the pattern.
337+
* matching the given host and pattern.
311338
*
339+
* @param <T> the request type.
312340
* @param hostname the host name
313341
* @param uriPattern the pattern to register the handler for.
314342
* @param requestHandler the handler.
@@ -321,6 +349,7 @@ public final <T> AsyncServerBootstrap register(final String hostname, final Stri
321349
}
322350

323351
/**
352+
* @param <T> the request type.
324353
* @return this instance.
325354
* @deprecated Use {@link #register(String, String, AsyncServerRequestHandler)}.
326355
*/

httpcore5/src/main/java/org/apache/hc/core5/http/io/HttpConnectionFactory.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,21 @@
4242
*/
4343
public interface HttpConnectionFactory<T extends HttpConnection> {
4444

45+
/**
46+
* Creates TLS connection with a {@link SSLSocket} layered over a plain {@link Socket}.
47+
*
48+
* @param socket the plain socket SSL socket has been layered over.
49+
* @return a new HttpConnection.
50+
* @throws IOException in case of an I/O error.
51+
*/
4552
T createConnection(Socket socket) throws IOException;
4653

4754
/**
4855
* Creates TLS connection with a {@link SSLSocket} layered over a plain {@link Socket}.
4956
*
5057
* @param sslSocket the SSL socket. May be {@code null}.
5158
* @param socket the plain socket SSL socket has been layered over.
59+
* @return a new HttpConnection.
5260
* @throws IOException in case of an I/O error.
5361
* @since 5.3
5462
*/

httpcore5/src/main/java/org/apache/hc/core5/http/io/HttpTransportMetrics.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@
3535
public interface HttpTransportMetrics {
3636

3737
/**
38-
* Returns the number of bytes transferred.
38+
* Gets the number of bytes transferred.
39+
*
40+
* @return the number of bytes transferred.
3941
*/
4042
long getBytesTransferred();
4143

0 commit comments

Comments
 (0)