diff --git a/spring-web/src/main/java/org/springframework/web/client/RestClient.java b/spring-web/src/main/java/org/springframework/web/client/RestClient.java index 1b7016d77e..475f8c864b 100644 --- a/spring-web/src/main/java/org/springframework/web/client/RestClient.java +++ b/spring-web/src/main/java/org/springframework/web/client/RestClient.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2024 the original author or authors. + * Copyright 2002-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -649,8 +649,8 @@ public interface RestClient { ResponseSpec retrieve(); /** - * Exchange the {@link ClientHttpResponse} for a type {@code T}. This - * can be useful for advanced scenarios, for example to decode the + * Exchange the {@link ClientHttpResponse} for a value of type {@code T}. + * This can be useful for advanced scenarios, for example to decode the * response differently depending on the response status: *
* Person person = client.get()
@@ -670,7 +670,7 @@ public interface RestClient {
* function has been invoked.
* @param exchangeFunction the function to handle the response with
* @param the type the response will be transformed to
- * @return the value returned from the exchange function
+ * @return the value returned from the exchange function, potentially {@code null}
*/
@Nullable
default T exchange(ExchangeFunction exchangeFunction) {
@@ -678,8 +678,8 @@ public interface RestClient {
}
/**
- * Exchange the {@link ClientHttpResponse} for a type {@code T}. This
- * can be useful for advanced scenarios, for example to decode the
+ * Exchange the {@link ClientHttpResponse} for a value of type {@code T}.
+ * This can be useful for advanced scenarios, for example to decode the
* response differently depending on the response status:
*
* Person person = client.get()
@@ -702,7 +702,7 @@ public interface RestClient {
* @param close {@code true} to close the response after
* {@code exchangeFunction} is invoked, {@code false} to keep it open
* @param the type the response will be transformed to
- * @return the value returned from the exchange function
+ * @return the value returned from the exchange function, potentially {@code null}
*/
@Nullable
T exchange(ExchangeFunction exchangeFunction, boolean close);
@@ -716,10 +716,10 @@ public interface RestClient {
interface ExchangeFunction {
/**
- * Exchange the given response into a type {@code T}.
+ * Exchange the given response into a value of type {@code T}.
* @param clientRequest the request
* @param clientResponse the response
- * @return the exchanged type
+ * @return the exchanged value, potentially {@code null}
* @throws IOException in case of I/O errors
*/
@Nullable