You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@juneau.apache.org by ja...@apache.org on 2022/08/12 14:40:16 UTC
[juneau] branch jbFixRestNpe updated: Remove unnecessary methods from RestClient.Builder.
This is an automated email from the ASF dual-hosted git repository.
jamesbognar pushed a commit to branch jbFixRestNpe
in repository https://gitbox.apache.org/repos/asf/juneau.git
The following commit(s) were added to refs/heads/jbFixRestNpe by this push:
new 09568256f Remove unnecessary methods from RestClient.Builder.
09568256f is described below
commit 09568256f0fd5adc37788aecd198ef8a766e9bd4
Author: JamesBognar <ja...@salesforce.com>
AuthorDate: Fri Aug 12 10:39:42 2022 -0400
Remove unnecessary methods from RestClient.Builder.
---
.../org/apache/juneau/rest/client/RestClient.java | 214 ---------------------
.../client/RestClient_Config_RestClient_Test.java | 9 -
2 files changed, 223 deletions(-)
diff --git a/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestClient.java b/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestClient.java
index e7def59d4..f26e9a472 100644
--- a/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestClient.java
+++ b/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestClient.java
@@ -1680,28 +1680,6 @@ public class RestClient extends BeanContextable implements HttpClient, Closeable
return httpClientBuilder;
}
- /**
- * Applies an operation to the HTTP client builder.
- *
- * <p>
- * Typically used to allow you to execute operations without breaking the fluent flow of the client builder.
- *
- * <h5 class='section'>Example:</h5>
- * <p class='bjava'>
- * RestClient <jv>client</jv> = RestClient
- * .<jsm>create</jsm>()
- * .httpClientBuilder(<jv>x</jv> -> <jv>x</jv>.disableAuthCaching())
- * .build();
- * </p>
- *
- * @param operation The operation to apply.
- * @return This object.
- */
- public final Builder httpClientBuilder(Consumer<HttpClientBuilder> operation) {
- operation.accept(httpClientBuilder());
- return this;
- }
-
/**
* Creates an instance of an {@link HttpClientBuilder} to be used to create the {@link HttpClient}.
*
@@ -1838,20 +1816,6 @@ public class RestClient extends BeanContextable implements HttpClient, Closeable
return serializers;
}
- /**
- * Applies an operation to the serializer group sub-builder.
- *
- * <p>
- * Typically used to allow you to execute operations without breaking the fluent flow of the client builder.
- *
- * @param operation The operation to apply.
- * @return This object.
- */
- public final Builder serializers(Consumer<SerializerSet.Builder> operation) {
- operation.accept(serializers());
- return this;
- }
-
/**
* Instantiates the serializer group sub-builder.
*
@@ -2024,20 +1988,6 @@ public class RestClient extends BeanContextable implements HttpClient, Closeable
return parsers;
}
- /**
- * Applies an operation to the parser group sub-builder.
- *
- * <p>
- * Typically used to allow you to execute operations without breaking the fluent flow of the client builder.
- *
- * @param operation The operation to apply.
- * @return This object.
- */
- public final Builder parsers(Consumer<ParserSet.Builder> operation) {
- operation.accept(parsers());
- return this;
- }
-
/**
* Instantiates the parser group sub-builder.
*
@@ -2210,20 +2160,6 @@ public class RestClient extends BeanContextable implements HttpClient, Closeable
return partSerializer;
}
- /**
- * Applies an operation to the part serializer sub-builder.
- *
- * <p>
- * Typically used to allow you to execute operations without breaking the fluent flow of the client builder.
- *
- * @param operation The operation to apply.
- * @return This object.
- */
- public final Builder partSerializer(Consumer<HttpPartSerializer.Creator> operation) {
- operation.accept(partSerializer());
- return this;
- }
-
/**
* Instantiates the part serializer sub-builder.
*
@@ -2306,20 +2242,6 @@ public class RestClient extends BeanContextable implements HttpClient, Closeable
return partParser;
}
- /**
- * Applies an operation to the part parser sub-builder.
- *
- * <p>
- * Typically used to allow you to execute operations without breaking the fluent flow of the client builder.
- *
- * @param operation The operation to apply.
- * @return This object.
- */
- public final Builder partParser(Consumer<HttpPartParser.Creator> operation) {
- operation.accept(partParser());
- return this;
- }
-
/**
* Instantiates the part parser sub-builder.
*
@@ -2402,20 +2324,6 @@ public class RestClient extends BeanContextable implements HttpClient, Closeable
return urlEncodingSerializer;
}
- /**
- * Applies an operation to the URL-encoding serializer sub-builder.
- *
- * <p>
- * Typically used to allow you to execute operations without breaking the fluent flow of the client builder.
- *
- * @param operation The operation to apply.
- * @return This object.
- */
- public final Builder urlEncodingSerializer(Consumer<UrlEncodingSerializer.Builder> operation) {
- operation.accept(urlEncodingSerializer());
- return this;
- }
-
/**
* Instantiates the URL-encoding serializer sub-builder.
*
@@ -2461,9 +2369,6 @@ public class RestClient extends BeanContextable implements HttpClient, Closeable
* <li class='jm'>{@link #noTrace()}
* </ul>
*
- * <p>
- * Note that the {@link #headers(Consumer)} method can be used to call this method without breaking fluent call chains.
- *
* @return The header list builder.
*/
public final HeaderList.Builder headers() {
@@ -2472,28 +2377,6 @@ public class RestClient extends BeanContextable implements HttpClient, Closeable
return headerData;
}
- /**
- * Applies an operation to the header data builder.
- *
- * <p>
- * Typically used to allow you to execute operations without breaking the fluent flow of the client builder.
- *
- * <h5 class='section'>Example:</h5>
- * <p class='bjava'>
- * RestClient <jv>client</jv> = RestClient
- * .<jsm>create</jsm>()
- * .headerData(<jv>x</jv> -> <jv>x</jv>.setDefault(<js>"Foo"</js>, <js>"bar"</js>))
- * .build();
- * </p>
- *
- * @param operation The operation to apply.
- * @return This object.
- */
- public final Builder headers(Consumer<HeaderList.Builder> operation) {
- operation.accept(headers());
- return this;
- }
-
/**
* Creates the builder for the header list.
*
@@ -2785,9 +2668,6 @@ public class RestClient extends BeanContextable implements HttpClient, Closeable
* <li class='jm'>{@link #queryData(String,Supplier)}
* </ul>
*
- * <p>
- * Note that the {@link #queryData(Consumer)} method can be used to call this method without breaking fluent call chains.
- *
* @return The query data list builder.
*/
public final PartList.Builder queryData() {
@@ -2796,28 +2676,6 @@ public class RestClient extends BeanContextable implements HttpClient, Closeable
return queryData;
}
- /**
- * Applies an operation to the query data builder.
- *
- * <p>
- * Typically used to allow you to execute operations without breaking the fluent flow of the client builder.
- *
- * <h5 class='section'>Example:</h5>
- * <p class='bjava'>
- * RestClient <jv>client</jv> = RestClient
- * .<jsm>create</jsm>()
- * .queryData(<jv>x</jv> -> <jv>x</jv>.setDefault(<js>"foo"</js>, <js>"bar"</js>))
- * .build();
- * </p>
- *
- * @param operation The operation to apply.
- * @return This object.
- */
- public final Builder queryData(Consumer<PartList.Builder> operation) {
- operation.accept(queryData());
- return this;
- }
-
/**
* Creates the builder for the query data list.
*
@@ -2968,9 +2826,6 @@ public class RestClient extends BeanContextable implements HttpClient, Closeable
* <li class='jm'>{@link #formData(String,Supplier)}
* </ul>
*
- * <p>
- * Note that the {@link #formData(Consumer)} method can be used to call this method without breaking fluent call chains.
- *
* @return The form data list builder.
*/
public final PartList.Builder formData() {
@@ -2979,28 +2834,6 @@ public class RestClient extends BeanContextable implements HttpClient, Closeable
return formData;
}
- /**
- * Applies an operation to the form data builder.
- *
- * <p>
- * Typically used to allow you to execute operations without breaking the fluent flow of the client builder.
- *
- * <h5 class='section'>Example:</h5>
- * <p class='bjava'>
- * RestClient <jv>client</jv> = RestClient
- * .<jsm>create</jsm>()
- * .formData(<jv>x</jv> -> <jv>x</jv>.setDefault(<js>"foo"</js>, <js>"bar"</js>))
- * .build();
- * </p>
- *
- * @param operation The operation to apply.
- * @return This object.
- */
- public final Builder formData(Consumer<PartList.Builder> operation) {
- operation.accept(formData());
- return this;
- }
-
/**
* Creates the builder for the form data list.
*
@@ -3151,9 +2984,6 @@ public class RestClient extends BeanContextable implements HttpClient, Closeable
* <li class='jm'>{@link #pathData(String,Supplier)}
* </ul>
*
- * <p>
- * Note that the {@link #pathData(Consumer)} method can be used to call this method without breaking fluent call chains.
- *
* @return The form data list builder.
*/
public final PartList.Builder pathData() {
@@ -3162,28 +2992,6 @@ public class RestClient extends BeanContextable implements HttpClient, Closeable
return pathData;
}
- /**
- * Applies an operation to the path data builder.
- *
- * <p>
- * Typically used to allow you to execute operations without breaking the fluent flow of the client builder.
- *
- * <h5 class='section'>Example:</h5>
- * <p class='bjava'>
- * RestClient <jv>client</jv> = RestClient
- * .<jsm>create</jsm>()
- * .pathData(<jv>x</jv> -> <jv>x</jv>.setDefault(<js>"foo"</js>, <js>"bar"</js>))
- * .build();
- * </p>
- *
- * @param operation The operation to apply.
- * @return This object.
- */
- public final Builder pathData(Consumer<PartList.Builder> operation) {
- operation.accept(pathData());
- return this;
- }
-
/**
* Creates the builder for the path data list.
*
@@ -3356,28 +3164,6 @@ public class RestClient extends BeanContextable implements HttpClient, Closeable
return callHandler;
}
- /**
- * Applies an operation to the REST call handler bean creator.
- *
- * <p>
- * Typically used to allow you to execute operations without breaking the fluent flow of the client builder.
- *
- * <h5 class='section'>Example:</h5>
- * <p class='bjava'>
- * RestClient <jv>client</jv> = RestClient
- * .<jsm>create</jsm>()
- * .callHandler(<jv>x</jv> -> <jv>x</jv>.impl(<jv>myCallHandler</jv>))
- * .build();
- * </p>
- *
- * @param operation The operation to apply.
- * @return This object.
- */
- public final Builder callHandler(Consumer<BeanCreator<RestCallHandler>> operation) {
- operation.accept(callHandler());
- return this;
- }
-
/**
* Creates the creator for the rest call handler.
*
diff --git a/juneau-utest/src/test/java/org/apache/juneau/rest/client/RestClient_Config_RestClient_Test.java b/juneau-utest/src/test/java/org/apache/juneau/rest/client/RestClient_Config_RestClient_Test.java
index 9914ecc7b..f7ecf7290 100644
--- a/juneau-utest/src/test/java/org/apache/juneau/rest/client/RestClient_Config_RestClient_Test.java
+++ b/juneau-utest/src/test/java/org/apache/juneau/rest/client/RestClient_Config_RestClient_Test.java
@@ -28,8 +28,6 @@ import org.apache.http.*;
import org.apache.http.HttpResponse;
import org.apache.http.client.*;
import org.apache.http.impl.client.*;
-import org.apache.http.message.*;
-import org.apache.http.message.BasicHttpResponse;
import org.apache.http.protocol.*;
import org.apache.juneau.*;
import org.apache.juneau.annotation.*;
@@ -107,14 +105,7 @@ public class RestClient_Config_RestClient_Test {
@Test
public void a01_callHandler() throws Exception {
- RestCallHandler x = new RestCallHandler() {
- @Override
- public HttpResponse run(HttpHost target, HttpRequest request, HttpContext context) throws ClientProtocolException, IOException {
- return new BasicHttpResponse(new BasicStatusLine(new ProtocolVersion("http",1,1),201,null));
- }
- };
client().callHandler(A1.class).header("Foo","f1").build().get("/checkHeader").header("Foo","f2").run().assertContent("['f1','f2','baz']");
- client().callHandler(y -> y.impl(x)).header("Foo","f1").build().get("/checkHeader").header("Foo","f2").run().assertStatus(201);
}
@Test