Skip to content

Commit d9047d3

Browse files
committed
Refine ExchangeFunction Javadoc
See gh-34692
1 parent 4db1280 commit d9047d3

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

Diff for: spring-web/src/main/java/org/springframework/web/client/RestClient.java

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2024 the original author or authors.
2+
* Copyright 2002-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -649,8 +649,8 @@ interface RequestHeadersSpec<S extends RequestHeadersSpec<S>> {
649649
ResponseSpec retrieve();
650650

651651
/**
652-
* Exchange the {@link ClientHttpResponse} for a type {@code T}. This
653-
* can be useful for advanced scenarios, for example to decode the
652+
* Exchange the {@link ClientHttpResponse} for a value of type {@code T}.
653+
* This can be useful for advanced scenarios, for example to decode the
654654
* response differently depending on the response status:
655655
* <pre class="code">
656656
* Person person = client.get()
@@ -670,16 +670,16 @@ interface RequestHeadersSpec<S extends RequestHeadersSpec<S>> {
670670
* function has been invoked.
671671
* @param exchangeFunction the function to handle the response with
672672
* @param <T> the type the response will be transformed to
673-
* @return the value returned from the exchange function
673+
* @return the value returned from the exchange function, potentially {@code null}
674674
*/
675675
@Nullable
676676
default <T> T exchange(ExchangeFunction<T> exchangeFunction) {
677677
return exchange(exchangeFunction, true);
678678
}
679679

680680
/**
681-
* Exchange the {@link ClientHttpResponse} for a type {@code T}. This
682-
* can be useful for advanced scenarios, for example to decode the
681+
* Exchange the {@link ClientHttpResponse} for a value of type {@code T}.
682+
* This can be useful for advanced scenarios, for example to decode the
683683
* response differently depending on the response status:
684684
* <pre class="code">
685685
* Person person = client.get()
@@ -702,7 +702,7 @@ default <T> T exchange(ExchangeFunction<T> exchangeFunction) {
702702
* @param close {@code true} to close the response after
703703
* {@code exchangeFunction} is invoked, {@code false} to keep it open
704704
* @param <T> the type the response will be transformed to
705-
* @return the value returned from the exchange function
705+
* @return the value returned from the exchange function, potentially {@code null}
706706
*/
707707
@Nullable
708708
<T> T exchange(ExchangeFunction<T> exchangeFunction, boolean close);
@@ -716,10 +716,10 @@ default <T> T exchange(ExchangeFunction<T> exchangeFunction) {
716716
interface ExchangeFunction<T> {
717717

718718
/**
719-
* Exchange the given response into a type {@code T}.
719+
* Exchange the given response into a value of type {@code T}.
720720
* @param clientRequest the request
721721
* @param clientResponse the response
722-
* @return the exchanged type
722+
* @return the exchanged value, potentially {@code null}
723723
* @throws IOException in case of I/O errors
724724
*/
725725
@Nullable

0 commit comments

Comments
 (0)