1
1
/*
2
- * Copyright 2002-2024 the original author or authors.
2
+ * Copyright 2002-2025 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
@@ -649,8 +649,8 @@ interface RequestHeadersSpec<S extends RequestHeadersSpec<S>> {
649
649
ResponseSpec retrieve ();
650
650
651
651
/**
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
654
654
* response differently depending on the response status:
655
655
* <pre class="code">
656
656
* Person person = client.get()
@@ -670,16 +670,16 @@ interface RequestHeadersSpec<S extends RequestHeadersSpec<S>> {
670
670
* function has been invoked.
671
671
* @param exchangeFunction the function to handle the response with
672
672
* @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}
674
674
*/
675
675
@ Nullable
676
676
default <T > T exchange (ExchangeFunction <T > exchangeFunction ) {
677
677
return exchange (exchangeFunction , true );
678
678
}
679
679
680
680
/**
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
683
683
* response differently depending on the response status:
684
684
* <pre class="code">
685
685
* Person person = client.get()
@@ -702,7 +702,7 @@ default <T> T exchange(ExchangeFunction<T> exchangeFunction) {
702
702
* @param close {@code true} to close the response after
703
703
* {@code exchangeFunction} is invoked, {@code false} to keep it open
704
704
* @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}
706
706
*/
707
707
@ Nullable
708
708
<T > T exchange (ExchangeFunction <T > exchangeFunction , boolean close );
@@ -716,10 +716,10 @@ default <T> T exchange(ExchangeFunction<T> exchangeFunction) {
716
716
interface ExchangeFunction <T > {
717
717
718
718
/**
719
- * Exchange the given response into a type {@code T}.
719
+ * Exchange the given response into a value of type {@code T}.
720
720
* @param clientRequest the request
721
721
* @param clientResponse the response
722
- * @return the exchanged type
722
+ * @return the exchanged value, potentially {@code null}
723
723
* @throws IOException in case of I/O errors
724
724
*/
725
725
@ Nullable
0 commit comments