HTTPCLIENT-2031: Don't use plural names for enums

This closes #180
This commit is contained in:
Michael Osipov 2019-12-05 22:06:17 +01:00 committed by Michael Osipov
parent 1d56c27e6d
commit 6cff260eff
10 changed files with 38 additions and 38 deletions

View File

@ -38,7 +38,7 @@ import org.apache.hc.client5.http.cache.HttpAsyncCacheStorage;
import org.apache.hc.client5.http.cache.HttpAsyncCacheStorageAdaptor;
import org.apache.hc.client5.http.cache.HttpCacheStorage;
import org.apache.hc.client5.http.cache.ResourceFactory;
import org.apache.hc.client5.http.impl.ChainElements;
import org.apache.hc.client5.http.impl.ChainElement;
import org.apache.hc.client5.http.impl.async.H2AsyncClientBuilder;
import org.apache.hc.client5.http.impl.schedule.ImmediateSchedulingStrategy;
import org.apache.hc.client5.http.schedule.SchedulingStrategy;
@ -168,7 +168,7 @@ public class CachingH2AsyncClientBuilder extends H2AsyncClientBuilder {
httpCache,
cacheRevalidator,
config);
execChainDefinition.addBefore(ChainElements.PROTOCOL.name(), cachingExec, ChainElements.CACHING.name());
execChainDefinition.addBefore(ChainElement.PROTOCOL.name(), cachingExec, ChainElement.CACHING.name());
}
}

View File

@ -38,7 +38,7 @@ import org.apache.hc.client5.http.cache.HttpAsyncCacheStorage;
import org.apache.hc.client5.http.cache.HttpAsyncCacheStorageAdaptor;
import org.apache.hc.client5.http.cache.HttpCacheStorage;
import org.apache.hc.client5.http.cache.ResourceFactory;
import org.apache.hc.client5.http.impl.ChainElements;
import org.apache.hc.client5.http.impl.ChainElement;
import org.apache.hc.client5.http.impl.async.HttpAsyncClientBuilder;
import org.apache.hc.client5.http.impl.schedule.ImmediateSchedulingStrategy;
import org.apache.hc.client5.http.schedule.SchedulingStrategy;
@ -168,7 +168,7 @@ public class CachingHttpAsyncClientBuilder extends HttpAsyncClientBuilder {
httpCache,
cacheRevalidator,
config);
execChainDefinition.addBefore(ChainElements.PROTOCOL.name(), cachingExec, ChainElements.CACHING.name());
execChainDefinition.addBefore(ChainElement.PROTOCOL.name(), cachingExec, ChainElement.CACHING.name());
}
}

View File

@ -36,7 +36,7 @@ import org.apache.hc.client5.http.cache.HttpCacheInvalidator;
import org.apache.hc.client5.http.cache.HttpCacheStorage;
import org.apache.hc.client5.http.cache.ResourceFactory;
import org.apache.hc.client5.http.classic.ExecChainHandler;
import org.apache.hc.client5.http.impl.ChainElements;
import org.apache.hc.client5.http.impl.ChainElement;
import org.apache.hc.client5.http.impl.classic.HttpClientBuilder;
import org.apache.hc.client5.http.impl.schedule.ImmediateSchedulingStrategy;
import org.apache.hc.client5.http.schedule.SchedulingStrategy;
@ -161,7 +161,7 @@ public class CachingHttpClientBuilder extends HttpClientBuilder {
httpCache,
cacheRevalidator,
config);
execChainDefinition.addBefore(ChainElements.PROTOCOL.name(), cachingExec, ChainElements.CACHING.name());
execChainDefinition.addBefore(ChainElement.PROTOCOL.name(), cachingExec, ChainElement.CACHING.name());
}
}

View File

@ -32,7 +32,7 @@ package org.apache.hc.client5.http.impl;
*
* @since 5.0
*/
public enum ChainElements {
public enum ChainElement {
REDIRECT, BACK_OFF, RETRY, RETRY_SERVICE_UNAVAILABLE, RETRY_IO_ERROR, CACHING, PROTOCOL,
CONNECT, MAIN_TRANSPORT

View File

@ -53,7 +53,7 @@ import org.apache.hc.client5.http.config.RequestConfig;
import org.apache.hc.client5.http.cookie.BasicCookieStore;
import org.apache.hc.client5.http.cookie.CookieSpecProvider;
import org.apache.hc.client5.http.cookie.CookieStore;
import org.apache.hc.client5.http.impl.ChainElements;
import org.apache.hc.client5.http.impl.ChainElement;
import org.apache.hc.client5.http.impl.CookieSpecSupport;
import org.apache.hc.client5.http.impl.DefaultAuthenticationStrategy;
import org.apache.hc.client5.http.impl.DefaultHttpRequestRetryStrategy;
@ -609,7 +609,7 @@ public class H2AsyncClientBuilder {
final NamedElementChain<AsyncExecChainHandler> execChainDefinition = new NamedElementChain<>();
execChainDefinition.addLast(
new H2AsyncMainClientExec(),
ChainElements.MAIN_TRANSPORT.name());
ChainElement.MAIN_TRANSPORT.name());
AuthenticationStrategy targetAuthStrategyCopy = this.targetAuthStrategy;
if (targetAuthStrategyCopy == null) {
@ -635,7 +635,7 @@ public class H2AsyncClientBuilder {
new AsyncConnectExec(
new DefaultHttpProcessor(new RequestTargetHost(), new RequestUserAgent(userAgentCopy)),
proxyAuthStrategyCopy),
ChainElements.CONNECT.name());
ChainElement.CONNECT.name());
final HttpProcessorBuilder b = HttpProcessorBuilder.create();
if (requestInterceptors != null) {
@ -683,7 +683,7 @@ public class H2AsyncClientBuilder {
final HttpProcessor httpProcessor = b.build();
execChainDefinition.addFirst(
new AsyncProtocolExec(httpProcessor, targetAuthStrategyCopy, proxyAuthStrategyCopy),
ChainElements.PROTOCOL.name());
ChainElement.PROTOCOL.name());
// Add request retry executor, if not disabled
if (!automaticRetriesDisabled) {
@ -691,7 +691,7 @@ public class H2AsyncClientBuilder {
if (retryHandlerCopy != null) {
execChainDefinition.addFirst(
new AsyncRetryExec(retryHandlerCopy),
ChainElements.RETRY_IO_ERROR.name());
ChainElement.RETRY_IO_ERROR.name());
} else {
HttpRequestRetryStrategy retryStrategyCopy = this.retryStrategy;
if (retryStrategyCopy == null) {
@ -699,7 +699,7 @@ public class H2AsyncClientBuilder {
}
execChainDefinition.addFirst(
new AsyncHttpRequestRetryExec(retryStrategyCopy),
ChainElements.RETRY.name());
ChainElement.RETRY.name());
}
}
@ -720,7 +720,7 @@ public class H2AsyncClientBuilder {
}
execChainDefinition.addFirst(
new AsyncRedirectExec(routePlannerCopy, redirectStrategyCopy),
ChainElements.REDIRECT.name());
ChainElement.REDIRECT.name());
}
final AsyncPushConsumerRegistry pushConsumerRegistry = new AsyncPushConsumerRegistry();

View File

@ -54,7 +54,7 @@ import org.apache.hc.client5.http.config.RequestConfig;
import org.apache.hc.client5.http.cookie.BasicCookieStore;
import org.apache.hc.client5.http.cookie.CookieSpecProvider;
import org.apache.hc.client5.http.cookie.CookieStore;
import org.apache.hc.client5.http.impl.ChainElements;
import org.apache.hc.client5.http.impl.ChainElement;
import org.apache.hc.client5.http.impl.CookieSpecSupport;
import org.apache.hc.client5.http.impl.DefaultAuthenticationStrategy;
import org.apache.hc.client5.http.impl.DefaultConnectionKeepAliveStrategy;
@ -759,7 +759,7 @@ public class HttpAsyncClientBuilder {
final NamedElementChain<AsyncExecChainHandler> execChainDefinition = new NamedElementChain<>();
execChainDefinition.addLast(
new HttpAsyncMainClientExec(keepAliveStrategyCopy, userTokenHandlerCopy),
ChainElements.MAIN_TRANSPORT.name());
ChainElement.MAIN_TRANSPORT.name());
AuthenticationStrategy targetAuthStrategyCopy = this.targetAuthStrategy;
if (targetAuthStrategyCopy == null) {
@ -785,7 +785,7 @@ public class HttpAsyncClientBuilder {
new AsyncConnectExec(
new DefaultHttpProcessor(new RequestTargetHost(), new RequestUserAgent(userAgentCopy)),
proxyAuthStrategyCopy),
ChainElements.CONNECT.name());
ChainElement.CONNECT.name());
final HttpProcessorBuilder b = HttpProcessorBuilder.create();
if (requestInterceptors != null) {
@ -833,7 +833,7 @@ public class HttpAsyncClientBuilder {
final HttpProcessor httpProcessor = b.build();
execChainDefinition.addFirst(
new AsyncProtocolExec(httpProcessor, targetAuthStrategyCopy, proxyAuthStrategyCopy),
ChainElements.PROTOCOL.name());
ChainElement.PROTOCOL.name());
// Add request retry executor, if not disabled
if (!automaticRetriesDisabled) {
@ -841,7 +841,7 @@ public class HttpAsyncClientBuilder {
if (retryHandlerCopy != null) {
execChainDefinition.addFirst(
new AsyncRetryExec(retryHandlerCopy),
ChainElements.RETRY_IO_ERROR.name());
ChainElement.RETRY_IO_ERROR.name());
} else {
HttpRequestRetryStrategy retryStrategyCopy = this.retryStrategy;
if (retryStrategyCopy == null) {
@ -849,7 +849,7 @@ public class HttpAsyncClientBuilder {
}
execChainDefinition.addFirst(
new AsyncHttpRequestRetryExec(retryStrategyCopy),
ChainElements.RETRY.name());
ChainElement.RETRY.name());
}
}
@ -883,7 +883,7 @@ public class HttpAsyncClientBuilder {
}
execChainDefinition.addFirst(
new AsyncRedirectExec(routePlannerCopy, redirectStrategyCopy),
ChainElements.REDIRECT.name());
ChainElement.REDIRECT.name());
}
List<Closeable> closeablesCopy = closeables != null ? new ArrayList<>(closeables) : null;

View File

@ -57,7 +57,7 @@ import org.apache.hc.client5.http.cookie.BasicCookieStore;
import org.apache.hc.client5.http.cookie.CookieSpecProvider;
import org.apache.hc.client5.http.cookie.CookieStore;
import org.apache.hc.client5.http.entity.InputStreamFactory;
import org.apache.hc.client5.http.impl.ChainElements;
import org.apache.hc.client5.http.impl.ChainElement;
import org.apache.hc.client5.http.impl.CookieSpecSupport;
import org.apache.hc.client5.http.impl.DefaultAuthenticationStrategy;
import org.apache.hc.client5.http.impl.DefaultConnectionKeepAliveStrategy;
@ -812,13 +812,13 @@ public class HttpClientBuilder {
final NamedElementChain<ExecChainHandler> execChainDefinition = new NamedElementChain<>();
execChainDefinition.addLast(
new MainClientExec(connManagerCopy, reuseStrategyCopy, keepAliveStrategyCopy, userTokenHandlerCopy),
ChainElements.MAIN_TRANSPORT.name());
ChainElement.MAIN_TRANSPORT.name());
execChainDefinition.addFirst(
new ConnectExec(
reuseStrategyCopy,
new DefaultHttpProcessor(new RequestTargetHost(), new RequestUserAgent(userAgentCopy)),
proxyAuthStrategyCopy),
ChainElements.CONNECT.name());
ChainElement.CONNECT.name());
final HttpProcessorBuilder b = HttpProcessorBuilder.create();
if (requestInterceptors != null) {
@ -868,7 +868,7 @@ public class HttpClientBuilder {
final HttpProcessor httpProcessor = b.build();
execChainDefinition.addFirst(
new ProtocolExec(httpProcessor, targetAuthStrategyCopy, proxyAuthStrategyCopy),
ChainElements.PROTOCOL.name());
ChainElement.PROTOCOL.name());
// Add request retry executor, if not disabled
if (!automaticRetriesDisabled) {
@ -877,7 +877,7 @@ public class HttpClientBuilder {
if (retryHandlerCopy != null) {
execChainDefinition.addFirst(
new RetryExec(retryHandlerCopy),
ChainElements.RETRY_IO_ERROR.name());
ChainElement.RETRY_IO_ERROR.name());
} else {
HttpRequestRetryStrategy retryStrategyCopy = this.retryStrategy;
if (retryStrategyCopy == null) {
@ -885,7 +885,7 @@ public class HttpClientBuilder {
}
execChainDefinition.addFirst(
new HttpRequestRetryExec(retryStrategyCopy),
ChainElements.RETRY.name());
ChainElement.RETRY.name());
}
}
@ -910,7 +910,7 @@ public class HttpClientBuilder {
if (serviceUnavailStrategyCopy != null) {
execChainDefinition.addFirst(
new ServiceUnavailableRetryExec(serviceUnavailStrategyCopy),
ChainElements.RETRY_SERVICE_UNAVAILABLE.name());
ChainElement.RETRY_SERVICE_UNAVAILABLE.name());
}
// Add redirect executor, if not disabled
@ -921,7 +921,7 @@ public class HttpClientBuilder {
}
execChainDefinition.addFirst(
new RedirectExec(routePlannerCopy, redirectStrategyCopy),
ChainElements.REDIRECT.name());
ChainElement.REDIRECT.name());
}
if (!contentCompressionDisabled) {
@ -934,18 +934,18 @@ public class HttpClientBuilder {
final Registry<InputStreamFactory> decoderRegistry = b2.build();
execChainDefinition.addFirst(
new ContentCompressionExec(encodings, decoderRegistry, true),
ChainElements.REDIRECT.name());
ChainElement.REDIRECT.name());
} else {
execChainDefinition.addFirst(
new ContentCompressionExec(true),
ChainElements.REDIRECT.name());
ChainElement.REDIRECT.name());
}
}
// Optionally, add connection back-off executor
if (this.backoffManager != null && this.connectionBackoffStrategy != null) {
execChainDefinition.addFirst(new BackoffStrategyExec(this.connectionBackoffStrategy, this.backoffManager),
ChainElements.BACK_OFF.name());
ChainElement.BACK_OFF.name());
}
if (execInterceptors != null) {

View File

@ -39,7 +39,7 @@ import org.apache.hc.client5.http.async.AsyncExecChainHandler;
import org.apache.hc.client5.http.async.methods.SimpleHttpRequest;
import org.apache.hc.client5.http.async.methods.SimpleHttpRequests;
import org.apache.hc.client5.http.async.methods.SimpleHttpResponse;
import org.apache.hc.client5.http.impl.ChainElements;
import org.apache.hc.client5.http.impl.ChainElement;
import org.apache.hc.client5.http.impl.async.CloseableHttpAsyncClient;
import org.apache.hc.client5.http.impl.async.HttpAsyncClients;
import org.apache.hc.core5.concurrent.FutureCallback;
@ -92,7 +92,7 @@ public class AsyncClientInterceptors {
// Simulate a 404 response for some requests without passing the message down to the backend
.addExecInterceptorAfter(ChainElements.PROTOCOL.name(), "custom", new AsyncExecChainHandler() {
.addExecInterceptorAfter(ChainElement.PROTOCOL.name(), "custom", new AsyncExecChainHandler() {
@Override
public void execute(

View File

@ -35,7 +35,7 @@ import org.apache.hc.client5.http.async.AsyncExecChain;
import org.apache.hc.client5.http.async.AsyncExecChainHandler;
import org.apache.hc.client5.http.async.methods.SimpleHttpResponse;
import org.apache.hc.client5.http.async.methods.SimpleResponseConsumer;
import org.apache.hc.client5.http.impl.ChainElements;
import org.apache.hc.client5.http.impl.ChainElement;
import org.apache.hc.client5.http.impl.async.CloseableHttpAsyncClient;
import org.apache.hc.client5.http.impl.async.HttpAsyncClients;
import org.apache.hc.core5.concurrent.FutureCallback;
@ -65,7 +65,7 @@ public class AsyncClientMessageTrailers {
final CloseableHttpAsyncClient client = HttpAsyncClients.custom()
.setIOReactorConfig(ioReactorConfig)
.addExecInterceptorAfter(ChainElements.PROTOCOL.name(), "custom", new AsyncExecChainHandler() {
.addExecInterceptorAfter(ChainElement.PROTOCOL.name(), "custom", new AsyncExecChainHandler() {
@Override
public void execute(

View File

@ -33,7 +33,7 @@ import java.util.concurrent.atomic.AtomicLong;
import org.apache.hc.client5.http.classic.ExecChain;
import org.apache.hc.client5.http.classic.ExecChainHandler;
import org.apache.hc.client5.http.classic.methods.HttpGet;
import org.apache.hc.client5.http.impl.ChainElements;
import org.apache.hc.client5.http.impl.ChainElement;
import org.apache.hc.client5.http.impl.classic.CloseableHttpClient;
import org.apache.hc.client5.http.impl.classic.CloseableHttpResponse;
import org.apache.hc.client5.http.impl.classic.HttpClients;
@ -77,7 +77,7 @@ public class ClientInterceptors {
// Simulate a 404 response for some requests without passing the message down to the backend
.addExecInterceptorAfter(ChainElements.PROTOCOL.name(), "custom", new ExecChainHandler() {
.addExecInterceptorAfter(ChainElement.PROTOCOL.name(), "custom", new ExecChainHandler() {
@Override
public ClassicHttpResponse execute(