diff --git a/spring-messaging/src/main/java/org/springframework/messaging/rsocket/DefaultRSocketRequester.java b/spring-messaging/src/main/java/org/springframework/messaging/rsocket/DefaultRSocketRequester.java index 6816b796d8..8980ad9ada 100644 --- a/spring-messaging/src/main/java/org/springframework/messaging/rsocket/DefaultRSocketRequester.java +++ b/spring-messaging/src/main/java/org/springframework/messaging/rsocket/DefaultRSocketRequester.java @@ -157,24 +157,24 @@ final class DefaultRSocketRequester implements RSocketRequester { } @Override - public ResponseSpec data(Object producer, Class elementType) { + public ResponseSpec data(Object producer, Class elementClass) { Assert.notNull(producer, "'producer' must not be null"); - Assert.notNull(elementType, "'dataType' must not be null"); + Assert.notNull(elementClass, "'elementClass' must not be null"); ReactiveAdapter adapter = strategies.reactiveAdapterRegistry().getAdapter(producer.getClass()); Assert.notNull(adapter, "'producer' type is unknown to ReactiveAdapterRegistry"); - return toResponseSpec(adapter.toPublisher(producer), ResolvableType.forClass(elementType)); + return toResponseSpec(adapter.toPublisher(producer), ResolvableType.forClass(elementClass)); } @Override - public ResponseSpec data(Object producer, ParameterizedTypeReference dataTypeRef) { + public ResponseSpec data(Object producer, ParameterizedTypeReference elementTypeRef) { Assert.notNull(producer, "'producer' must not be null"); - Assert.notNull(dataTypeRef, "'dataTypeRef' must not be null"); + Assert.notNull(elementTypeRef, "'elementTypeRef' must not be null"); ReactiveAdapter adapter = strategies.reactiveAdapterRegistry().getAdapter(producer.getClass()); Assert.notNull(adapter, "'producer' type is unknown to ReactiveAdapterRegistry"); - return toResponseSpec(adapter.toPublisher(producer), ResolvableType.forType(dataTypeRef)); + return toResponseSpec(adapter.toPublisher(producer), ResolvableType.forType(elementTypeRef)); } - private ResponseSpec toResponseSpec(Object input, ResolvableType dataType) { + private ResponseSpec toResponseSpec(Object input, ResolvableType elementType) { ReactiveAdapter adapter = strategies.reactiveAdapterRegistry().getAdapter(input.getClass()); Publisher publisher; if (input instanceof Publisher) { @@ -192,24 +192,24 @@ final class DefaultRSocketRequester implements RSocketRequester { return new DefaultResponseSpec(payloadMono); } - if (isVoid(dataType) || (adapter != null && adapter.isNoValue())) { + if (isVoid(elementType) || (adapter != null && adapter.isNoValue())) { Mono payloadMono = Mono.when(publisher).then(emptyPayload()); return new DefaultResponseSpec(payloadMono); } - Encoder encoder = dataType != ResolvableType.NONE && !Object.class.equals(dataType.resolve()) ? - strategies.encoder(dataType, dataMimeType) : null; + Encoder encoder = elementType != ResolvableType.NONE && !Object.class.equals(elementType.resolve()) ? + strategies.encoder(elementType, dataMimeType) : null; if (adapter != null && !adapter.isMultiValue()) { Mono payloadMono = Mono.from(publisher) - .map(value -> encodeData(value, dataType, encoder)) + .map(value -> encodeData(value, elementType, encoder)) .map(this::firstPayload) .switchIfEmpty(emptyPayload()); return new DefaultResponseSpec(payloadMono); } Flux payloadFlux = Flux.from(publisher) - .map(value -> encodeData(value, dataType, encoder)) + .map(value -> encodeData(value, elementType, encoder)) .switchOnFirst((signal, inner) -> { DataBuffer data = signal.get(); if (data != null) { @@ -226,16 +226,16 @@ final class DefaultRSocketRequester implements RSocketRequester { } @SuppressWarnings("unchecked") - private DataBuffer encodeData(T value, ResolvableType valueType, @Nullable Encoder encoder) { + private DataBuffer encodeData(T value, ResolvableType elementType, @Nullable Encoder encoder) { if (value instanceof DataBuffer) { return (DataBuffer) value; } if (encoder == null) { - valueType = ResolvableType.forInstance(value); - encoder = strategies.encoder(valueType, dataMimeType); + elementType = ResolvableType.forInstance(value); + encoder = strategies.encoder(elementType, dataMimeType); } return ((Encoder) encoder).encodeValue( - value, bufferFactory(), valueType, dataMimeType, EMPTY_HINTS); + value, bufferFactory(), elementType, dataMimeType, EMPTY_HINTS); } private Payload firstPayload(DataBuffer data) { diff --git a/spring-messaging/src/main/java/org/springframework/messaging/rsocket/RSocketRequester.java b/spring-messaging/src/main/java/org/springframework/messaging/rsocket/RSocketRequester.java index 6864e2d1e0..142a41dd18 100644 --- a/spring-messaging/src/main/java/org/springframework/messaging/rsocket/RSocketRequester.java +++ b/spring-messaging/src/main/java/org/springframework/messaging/rsocket/RSocketRequester.java @@ -243,10 +243,10 @@ public interface RSocketRequester { * @param producer the source of payload data value(s). This must be a * {@link Publisher} or another producer adaptable to a * {@code Publisher} via {@link ReactiveAdapterRegistry} - * @param elementType the type of values to be produced + * @param elementClass the type of values to be produced * @return spec for declaring the expected response */ - ResponseSpec data(Object producer, Class elementType); + ResponseSpec data(Object producer, Class elementClass); /** * Alternative of {@link #data(Object, Class)} but with a diff --git a/spring-test/src/main/java/org/springframework/test/web/reactive/server/DefaultWebTestClient.java b/spring-test/src/main/java/org/springframework/test/web/reactive/server/DefaultWebTestClient.java index 3d03e6e5ff..d61cfd7f6b 100644 --- a/spring-test/src/main/java/org/springframework/test/web/reactive/server/DefaultWebTestClient.java +++ b/spring-test/src/main/java/org/springframework/test/web/reactive/server/DefaultWebTestClient.java @@ -273,8 +273,8 @@ class DefaultWebTestClient implements WebTestClient { } @Override - public RequestHeadersSpec body(Object producer, ParameterizedTypeReference elementType) { - this.bodySpec.body(producer, elementType); + public RequestHeadersSpec body(Object producer, ParameterizedTypeReference elementTypeRef) { + this.bodySpec.body(producer, elementTypeRef); return this; } @@ -285,8 +285,8 @@ class DefaultWebTestClient implements WebTestClient { } @Override - public > RequestHeadersSpec body(S publisher, ParameterizedTypeReference elementType) { - this.bodySpec.body(publisher, elementType); + public > RequestHeadersSpec body(S publisher, ParameterizedTypeReference elementTypeRef) { + this.bodySpec.body(publisher, elementTypeRef); return this; } @@ -379,14 +379,14 @@ class DefaultWebTestClient implements WebTestClient { } @Override - public FluxExchangeResult returnResult(Class elementType) { - Flux body = this.response.bodyToFlux(elementType); + public FluxExchangeResult returnResult(Class elementClass) { + Flux body = this.response.bodyToFlux(elementClass); return new FluxExchangeResult<>(this.exchangeResult, body); } @Override - public FluxExchangeResult returnResult(ParameterizedTypeReference elementType) { - Flux body = this.response.bodyToFlux(elementType); + public FluxExchangeResult returnResult(ParameterizedTypeReference elementTypeRef) { + Flux body = this.response.bodyToFlux(elementTypeRef); return new FluxExchangeResult<>(this.exchangeResult, body); } } diff --git a/spring-test/src/main/java/org/springframework/test/web/reactive/server/WebTestClient.java b/spring-test/src/main/java/org/springframework/test/web/reactive/server/WebTestClient.java index 9180920bcf..27ac397669 100644 --- a/spring-test/src/main/java/org/springframework/test/web/reactive/server/WebTestClient.java +++ b/spring-test/src/main/java/org/springframework/test/web/reactive/server/WebTestClient.java @@ -660,11 +660,11 @@ public interface WebTestClient { * @param producer the producer to write to the request. This must be a * {@link Publisher} or another producer adaptable to a * {@code Publisher} via {@link ReactiveAdapterRegistry} - * @param elementType the type reference of elements contained in the producer + * @param elementTypeRef the type reference of elements contained in the producer * @return spec for decoding the response * @since 5.2 */ - RequestHeadersSpec body(Object producer, ParameterizedTypeReference elementType); + RequestHeadersSpec body(Object producer, ParameterizedTypeReference elementTypeRef); /** * Set the body of the request to the given asynchronous {@code Publisher}. @@ -679,13 +679,13 @@ public interface WebTestClient { /** * Set the body of the request to the given asynchronous {@code Publisher}. * @param publisher the request body data - * @param elementType the type reference of elements contained in the publisher + * @param elementTypeRef the type reference of elements contained in the publisher * @param the type of the elements contained in the publisher * @param the type of the {@code Publisher} * @return spec for decoding the response * @since 5.2 */ - > RequestHeadersSpec body(S publisher, ParameterizedTypeReference elementType); + > RequestHeadersSpec body(S publisher, ParameterizedTypeReference elementTypeRef); /** * Set the body of the request to the given {@code BodyInserter}. @@ -796,13 +796,13 @@ public interface WebTestClient { * {@code expectBody(Void.class)} which ensures that resources are * released regardless of whether the response has content or not. */ - FluxExchangeResult returnResult(Class elementType); + FluxExchangeResult returnResult(Class elementClass); /** * Alternative to {@link #returnResult(Class)} that accepts information * about a target type with generics. */ - FluxExchangeResult returnResult(ParameterizedTypeReference elementType); + FluxExchangeResult returnResult(ParameterizedTypeReference elementTypeRef); } diff --git a/spring-webflux/src/main/java/org/springframework/web/reactive/function/BodyExtractors.java b/spring-webflux/src/main/java/org/springframework/web/reactive/function/BodyExtractors.java index 2f1159cd33..391a5fbf90 100644 --- a/spring-webflux/src/main/java/org/springframework/web/reactive/function/BodyExtractors.java +++ b/spring-webflux/src/main/java/org/springframework/web/reactive/function/BodyExtractors.java @@ -72,12 +72,12 @@ public abstract class BodyExtractors { /** * Variant of {@link #toMono(Class)} for type information with generics. - * @param typeRef the type reference for the type to decode to + * @param elementTypeRef the type reference for the type to decode to * @param the element type to decode to * @return {@code BodyExtractor} for {@code Mono} */ - public static BodyExtractor, ReactiveHttpInputMessage> toMono(ParameterizedTypeReference typeRef) { - return toMono(ResolvableType.forType(typeRef.getType())); + public static BodyExtractor, ReactiveHttpInputMessage> toMono(ParameterizedTypeReference elementTypeRef) { + return toMono(ResolvableType.forType(elementTypeRef.getType())); } private static BodyExtractor, ReactiveHttpInputMessage> toMono(ResolvableType elementType) { diff --git a/spring-webflux/src/main/java/org/springframework/web/reactive/function/BodyInserters.java b/spring-webflux/src/main/java/org/springframework/web/reactive/function/BodyInserters.java index e869dc55c2..aca1e02c43 100644 --- a/spring-webflux/src/main/java/org/springframework/web/reactive/function/BodyInserters.java +++ b/spring-webflux/src/main/java/org/springframework/web/reactive/function/BodyInserters.java @@ -92,7 +92,7 @@ public abstract class BodyInserters { * @see #fromProducer(Object, Class) */ public static BodyInserter fromObject(T body) { - Assert.notNull(body, "Body must not be null"); + Assert.notNull(body, "'body' must not be null"); Assert.isNull(registry.getAdapter(body.getClass()), "'body' should be an object, for reactive types use a variant specifying a publisher/producer and its related element type"); return (message, context) -> writeWithMessageWriters(message, context, Mono.just(body), ResolvableType.forInstance(body), null); @@ -107,7 +107,7 @@ public abstract class BodyInserters { * {@link org.springframework.web.reactive.function.server.ServerResponse ServerResponse}. * @param the type of the body * @param producer the source of body value(s). - * @param elementClass the type of values to be produced + * @param elementClass the class of values to be produced * @return the inserter to write a producer * @since 5.2 */ @@ -129,17 +129,18 @@ public abstract class BodyInserters { * {@link org.springframework.web.reactive.function.server.ServerResponse ServerResponse}. * @param the type of the body * @param producer the source of body value(s). - * @param elementType the type of values to be produced + * @param elementTypeRef the type of values to be produced * @return the inserter to write a producer * @since 5.2 */ - public static BodyInserter fromProducer(T producer, ParameterizedTypeReference elementType) { + public static BodyInserter fromProducer(T producer, + ParameterizedTypeReference elementTypeRef) { Assert.notNull(producer, "'producer' must not be null"); - Assert.notNull(elementType, "'elementType' must not be null"); + Assert.notNull(elementTypeRef, "'elementTypeRef' must not be null"); ReactiveAdapter adapter = ReactiveAdapterRegistry.getSharedInstance().getAdapter(producer.getClass()); Assert.notNull(adapter, "'producer' type is unknown to ReactiveAdapterRegistry"); return (message, context) -> - writeWithMessageWriters(message, context, producer, ResolvableType.forType(elementType), adapter); + writeWithMessageWriters(message, context, producer, ResolvableType.forType(elementTypeRef), adapter); } /** @@ -148,7 +149,7 @@ public abstract class BodyInserters { * {@link org.springframework.web.reactive.function.client.WebClient WebClient} and * {@link org.springframework.web.reactive.function.server.ServerResponse ServerResponse}. * @param publisher the publisher to write with - * @param elementClass the type of elements in the publisher + * @param elementClass the class of elements in the publisher * @param the type of the elements contained in the publisher * @param

the {@code Publisher} type * @return the inserter to write a {@code Publisher} @@ -156,8 +157,8 @@ public abstract class BodyInserters { public static > BodyInserter fromPublisher( P publisher, Class elementClass) { - Assert.notNull(publisher, "Publisher must not be null"); - Assert.notNull(elementClass, "Element Class must not be null"); + Assert.notNull(publisher, "'publisher' must not be null"); + Assert.notNull(elementClass, "'elementClass' must not be null"); return (message, context) -> writeWithMessageWriters(message, context, publisher, ResolvableType.forClass(elementClass), null); } @@ -168,18 +169,18 @@ public abstract class BodyInserters { * {@link org.springframework.web.reactive.function.client.WebClient WebClient} and * {@link org.springframework.web.reactive.function.server.ServerResponse ServerResponse}. * @param publisher the publisher to write with - * @param typeReference the type of elements contained in the publisher + * @param elementTypeRef the type of elements contained in the publisher * @param the type of the elements contained in the publisher * @param

the {@code Publisher} type * @return the inserter to write a {@code Publisher} */ public static > BodyInserter fromPublisher( - P publisher, ParameterizedTypeReference typeReference) { + P publisher, ParameterizedTypeReference elementTypeRef) { - Assert.notNull(publisher, "Publisher must not be null"); - Assert.notNull(typeReference, "ParameterizedTypeReference must not be null"); + Assert.notNull(publisher, "'publisher' must not be null"); + Assert.notNull(elementTypeRef, "'elementTypeRef' must not be null"); return (message, context) -> - writeWithMessageWriters(message, context, publisher, ResolvableType.forType(typeReference.getType()), null); + writeWithMessageWriters(message, context, publisher, ResolvableType.forType(elementTypeRef.getType()), null); } /** @@ -191,7 +192,7 @@ public abstract class BodyInserters { * @return the inserter to write a {@code Publisher} */ public static BodyInserter fromResource(T resource) { - Assert.notNull(resource, "Resource must not be null"); + Assert.notNull(resource, "'resource' must not be null"); return (outputMessage, context) -> { ResolvableType elementType = RESOURCE_TYPE; HttpMessageWriter writer = findWriter(context, elementType, null); @@ -213,7 +214,7 @@ public abstract class BodyInserters { public static >> BodyInserter fromServerSentEvents( S eventsPublisher) { - Assert.notNull(eventsPublisher, "Publisher must not be null"); + Assert.notNull(eventsPublisher, "'eventsPublisher' must not be null"); return (serverResponse, context) -> { ResolvableType elementType = SSE_TYPE; MediaType mediaType = MediaType.TEXT_EVENT_STREAM; @@ -330,7 +331,7 @@ public abstract class BodyInserters { public static > BodyInserter fromDataBuffers( T publisher) { - Assert.notNull(publisher, "Publisher must not be null"); + Assert.notNull(publisher, "'publisher' must not be null"); return (outputMessage, context) -> outputMessage.writeWith(publisher); } diff --git a/spring-webflux/src/main/java/org/springframework/web/reactive/function/client/ClientResponse.java b/spring-webflux/src/main/java/org/springframework/web/reactive/function/client/ClientResponse.java index 9e43af5abc..a9fd5cedd0 100644 --- a/spring-webflux/src/main/java/org/springframework/web/reactive/function/client/ClientResponse.java +++ b/spring-webflux/src/main/java/org/springframework/web/reactive/function/client/ClientResponse.java @@ -108,15 +108,15 @@ public interface ClientResponse { /** * Extract the body to a {@code Mono}. - * @param typeReference a type reference describing the expected response body type + * @param elementTypeRef the type reference of element in the {@code Mono} * @param the element type * @return a mono containing the body of the given type {@code T} */ - Mono bodyToMono(ParameterizedTypeReference typeReference); + Mono bodyToMono(ParameterizedTypeReference elementTypeRef); /** * Extract the body to a {@code Flux}. - * @param elementClass the class of element in the {@code Flux} + * @param elementClass the class of elements in the {@code Flux} * @param the element type * @return a flux containing the body of the given type {@code T} */ @@ -124,43 +124,43 @@ public interface ClientResponse { /** * Extract the body to a {@code Flux}. - * @param typeReference a type reference describing the expected response body type + * @param elementTypeRef the type reference of elements in the {@code Flux} * @param the element type * @return a flux containing the body of the given type {@code T} */ - Flux bodyToFlux(ParameterizedTypeReference typeReference); + Flux bodyToFlux(ParameterizedTypeReference elementTypeRef); /** * Return this response as a delayed {@code ResponseEntity}. - * @param bodyType the expected response body type + * @param bodyClass the expected response body type * @param response body type * @return {@code Mono} with the {@code ResponseEntity} */ - Mono> toEntity(Class bodyType); + Mono> toEntity(Class bodyClass); /** * Return this response as a delayed {@code ResponseEntity}. - * @param typeReference a type reference describing the expected response body type + * @param bodyTypeReference a type reference describing the expected response body type * @param response body type * @return {@code Mono} with the {@code ResponseEntity} */ - Mono> toEntity(ParameterizedTypeReference typeReference); + Mono> toEntity(ParameterizedTypeReference bodyTypeReference); /** * Return this response as a delayed list of {@code ResponseEntity}s. - * @param elementType the expected response body list element type + * @param elementClass the expected response body list element class * @param the type of elements in the list * @return {@code Mono} with the list of {@code ResponseEntity}s */ - Mono>> toEntityList(Class elementType); + Mono>> toEntityList(Class elementClass); /** * Return this response as a delayed list of {@code ResponseEntity}s. - * @param typeReference a type reference describing the expected response body type + * @param elementTypeRef the expected response body list element reference type * @param the type of elements in the list * @return {@code Mono} with the list of {@code ResponseEntity}s */ - Mono>> toEntityList(ParameterizedTypeReference typeReference); + Mono>> toEntityList(ParameterizedTypeReference elementTypeRef); // Static builder methods diff --git a/spring-webflux/src/main/java/org/springframework/web/reactive/function/client/DefaultClientResponse.java b/spring-webflux/src/main/java/org/springframework/web/reactive/function/client/DefaultClientResponse.java index fdc5c36f03..ae9787e60b 100644 --- a/spring-webflux/src/main/java/org/springframework/web/reactive/function/client/DefaultClientResponse.java +++ b/spring-webflux/src/main/java/org/springframework/web/reactive/function/client/DefaultClientResponse.java @@ -132,8 +132,8 @@ class DefaultClientResponse implements ClientResponse { } @Override - public Mono bodyToMono(ParameterizedTypeReference typeReference) { - return body(BodyExtractors.toMono(typeReference)); + public Mono bodyToMono(ParameterizedTypeReference elementTypeRef) { + return body(BodyExtractors.toMono(elementTypeRef)); } @Override @@ -142,8 +142,8 @@ class DefaultClientResponse implements ClientResponse { } @Override - public Flux bodyToFlux(ParameterizedTypeReference typeReference) { - return body(BodyExtractors.toFlux(typeReference)); + public Flux bodyToFlux(ParameterizedTypeReference elementTypeRef) { + return body(BodyExtractors.toFlux(elementTypeRef)); } @Override @@ -152,8 +152,8 @@ class DefaultClientResponse implements ClientResponse { } @Override - public Mono> toEntity(ParameterizedTypeReference typeReference) { - return toEntityInternal(bodyToMono(typeReference)); + public Mono> toEntity(ParameterizedTypeReference bodyTypeReference) { + return toEntityInternal(bodyToMono(bodyTypeReference)); } private Mono> toEntityInternal(Mono bodyMono) { @@ -166,13 +166,13 @@ class DefaultClientResponse implements ClientResponse { } @Override - public Mono>> toEntityList(Class responseType) { - return toEntityListInternal(bodyToFlux(responseType)); + public Mono>> toEntityList(Class elementClass) { + return toEntityListInternal(bodyToFlux(elementClass)); } @Override - public Mono>> toEntityList(ParameterizedTypeReference typeReference) { - return toEntityListInternal(bodyToFlux(typeReference)); + public Mono>> toEntityList(ParameterizedTypeReference elementTypeRef) { + return toEntityListInternal(bodyToFlux(elementTypeRef)); } private Mono>> toEntityListInternal(Flux bodyFlux) { diff --git a/spring-webflux/src/main/java/org/springframework/web/reactive/function/client/DefaultWebClient.java b/spring-webflux/src/main/java/org/springframework/web/reactive/function/client/DefaultWebClient.java index 2be82f862b..3e309f4e44 100644 --- a/spring-webflux/src/main/java/org/springframework/web/reactive/function/client/DefaultWebClient.java +++ b/spring-webflux/src/main/java/org/springframework/web/reactive/function/client/DefaultWebClient.java @@ -303,15 +303,15 @@ class DefaultWebClient implements WebClient { } @Override - public RequestHeadersSpec body(Object producer, ParameterizedTypeReference elementType) { - this.inserter = BodyInserters.fromProducer(producer, elementType); + public RequestHeadersSpec body(Object producer, ParameterizedTypeReference elementTypeRef) { + this.inserter = BodyInserters.fromProducer(producer, elementTypeRef); return this; } @Override public > RequestHeadersSpec body( - P publisher, ParameterizedTypeReference elementType) { - this.inserter = BodyInserters.fromPublisher(publisher, elementType); + P publisher, ParameterizedTypeReference elementTypeRef) { + this.inserter = BodyInserters.fromPublisher(publisher, elementTypeRef); return this; } @@ -449,27 +449,27 @@ class DefaultWebClient implements WebClient { } @Override - public Mono bodyToMono(Class bodyType) { + public Mono bodyToMono(Class elementClass) { return this.responseMono.flatMap(response -> handleBody(response, - response.bodyToMono(bodyType), mono -> mono.flatMap(Mono::error))); + response.bodyToMono(elementClass), mono -> mono.flatMap(Mono::error))); } @Override - public Mono bodyToMono(ParameterizedTypeReference bodyType) { + public Mono bodyToMono(ParameterizedTypeReference elementTypeRef) { return this.responseMono.flatMap(response -> - handleBody(response, response.bodyToMono(bodyType), mono -> mono.flatMap(Mono::error))); + handleBody(response, response.bodyToMono(elementTypeRef), mono -> mono.flatMap(Mono::error))); } @Override - public Flux bodyToFlux(Class elementType) { + public Flux bodyToFlux(Class elementClass) { return this.responseMono.flatMapMany(response -> - handleBody(response, response.bodyToFlux(elementType), mono -> mono.handle((t, sink) -> sink.error(t)))); + handleBody(response, response.bodyToFlux(elementClass), mono -> mono.handle((t, sink) -> sink.error(t)))); } @Override - public Flux bodyToFlux(ParameterizedTypeReference elementType) { + public Flux bodyToFlux(ParameterizedTypeReference elementTypeRef) { return this.responseMono.flatMapMany(response -> - handleBody(response, response.bodyToFlux(elementType), mono -> mono.handle((t, sink) -> sink.error(t)))); + handleBody(response, response.bodyToFlux(elementTypeRef), mono -> mono.handle((t, sink) -> sink.error(t)))); } private > T handleBody(ClientResponse response, diff --git a/spring-webflux/src/main/java/org/springframework/web/reactive/function/client/WebClient.java b/spring-webflux/src/main/java/org/springframework/web/reactive/function/client/WebClient.java index b5cdfed4c2..70c21d3bdd 100644 --- a/spring-webflux/src/main/java/org/springframework/web/reactive/function/client/WebClient.java +++ b/spring-webflux/src/main/java/org/springframework/web/reactive/function/client/WebClient.java @@ -580,11 +580,11 @@ public interface WebClient { * @param producer the producer to write to the request. This must be a * {@link Publisher} or another producer adaptable to a * {@code Publisher} via {@link ReactiveAdapterRegistry} - * @param elementType the type reference of elements contained in the producer + * @param elementTypeRef the type reference of elements contained in the producer * @return this builder * @since 5.2 */ - RequestHeadersSpec body(Object producer, ParameterizedTypeReference elementType); + RequestHeadersSpec body(Object producer, ParameterizedTypeReference elementTypeRef); /** * A shortcut for {@link #body(BodyInserter)} with a @@ -613,13 +613,13 @@ public interface WebClient { * element type information that includes generics via a * {@link ParameterizedTypeReference}. * @param publisher the {@code Publisher} to write to the request - * @param elementType the type reference of elements contained in the publisher + * @param elementTypeRef the type reference of elements contained in the publisher * @param the type of the elements contained in the publisher * @param

the type of the {@code Publisher} * @return this builder */ > RequestHeadersSpec body(P publisher, - ParameterizedTypeReference elementType); + ParameterizedTypeReference elementTypeRef); /** * Set the body of the request using the given body inserter. @@ -690,45 +690,45 @@ public interface WebClient { * Extract the body to a {@code Mono}. By default, if the response has status code 4xx or * 5xx, the {@code Mono} will contain a {@link WebClientException}. This can be overridden * with {@link #onStatus(Predicate, Function)}. - * @param bodyType the expected response body type + * @param elementClass the expected response body element class * @param response body type * @return a mono containing the body, or a {@link WebClientResponseException} if the * status code is 4xx or 5xx */ - Mono bodyToMono(Class bodyType); + Mono bodyToMono(Class elementClass); /** * Extract the body to a {@code Mono}. By default, if the response has status code 4xx or * 5xx, the {@code Mono} will contain a {@link WebClientException}. This can be overridden * with {@link #onStatus(Predicate, Function)}. - * @param typeReference a type reference describing the expected response body type + * @param elementTypeRef a type reference describing the expected response body element type * @param response body type * @return a mono containing the body, or a {@link WebClientResponseException} if the * status code is 4xx or 5xx */ - Mono bodyToMono(ParameterizedTypeReference typeReference); + Mono bodyToMono(ParameterizedTypeReference elementTypeRef); /** * Extract the body to a {@code Flux}. By default, if the response has status code 4xx or * 5xx, the {@code Flux} will contain a {@link WebClientException}. This can be overridden * with {@link #onStatus(Predicate, Function)}. - * @param elementType the type of element in the response + * @param elementClass the class of elements in the response * @param the type of elements in the response * @return a flux containing the body, or a {@link WebClientResponseException} if the * status code is 4xx or 5xx */ - Flux bodyToFlux(Class elementType); + Flux bodyToFlux(Class elementClass); /** * Extract the body to a {@code Flux}. By default, if the response has status code 4xx or * 5xx, the {@code Flux} will contain a {@link WebClientException}. This can be overridden * with {@link #onStatus(Predicate, Function)}. - * @param typeReference a type reference describing the expected response body type + * @param elementTypeRef a type reference describing the expected response body element type * @param the type of elements in the response * @return a flux containing the body, or a {@link WebClientResponseException} if the * status code is 4xx or 5xx */ - Flux bodyToFlux(ParameterizedTypeReference typeReference); + Flux bodyToFlux(ParameterizedTypeReference elementTypeRef); } diff --git a/spring-webflux/src/main/java/org/springframework/web/reactive/function/client/support/ClientResponseWrapper.java b/spring-webflux/src/main/java/org/springframework/web/reactive/function/client/support/ClientResponseWrapper.java index f255977d82..49291ed08e 100644 --- a/spring-webflux/src/main/java/org/springframework/web/reactive/function/client/support/ClientResponseWrapper.java +++ b/spring-webflux/src/main/java/org/springframework/web/reactive/function/client/support/ClientResponseWrapper.java @@ -103,8 +103,8 @@ public class ClientResponseWrapper implements ClientResponse { } @Override - public Mono bodyToMono(ParameterizedTypeReference typeReference) { - return this.delegate.bodyToMono(typeReference); + public Mono bodyToMono(ParameterizedTypeReference elementTypeRef) { + return this.delegate.bodyToMono(elementTypeRef); } @Override @@ -113,8 +113,8 @@ public class ClientResponseWrapper implements ClientResponse { } @Override - public Flux bodyToFlux(ParameterizedTypeReference typeReference) { - return this.delegate.bodyToFlux(typeReference); + public Flux bodyToFlux(ParameterizedTypeReference elementTypeRef) { + return this.delegate.bodyToFlux(elementTypeRef); } @Override @@ -123,18 +123,18 @@ public class ClientResponseWrapper implements ClientResponse { } @Override - public Mono> toEntity(ParameterizedTypeReference typeReference) { - return this.delegate.toEntity(typeReference); + public Mono> toEntity(ParameterizedTypeReference bodyTypeReference) { + return this.delegate.toEntity(bodyTypeReference); } @Override - public Mono>> toEntityList(Class elementType) { - return this.delegate.toEntityList(elementType); + public Mono>> toEntityList(Class elementClass) { + return this.delegate.toEntityList(elementClass); } @Override - public Mono>> toEntityList(ParameterizedTypeReference typeReference) { - return this.delegate.toEntityList(typeReference); + public Mono>> toEntityList(ParameterizedTypeReference elementTypeRef) { + return this.delegate.toEntityList(elementTypeRef); } /** diff --git a/spring-webflux/src/main/java/org/springframework/web/reactive/function/server/DefaultServerResponseBuilder.java b/spring-webflux/src/main/java/org/springframework/web/reactive/function/server/DefaultServerResponseBuilder.java index 49e35a9cf3..841b31840f 100644 --- a/spring-webflux/src/main/java/org/springframework/web/reactive/function/server/DefaultServerResponseBuilder.java +++ b/spring-webflux/src/main/java/org/springframework/web/reactive/function/server/DefaultServerResponseBuilder.java @@ -247,9 +247,9 @@ class DefaultServerResponseBuilder implements ServerResponse.BodyBuilder { } @Override - public Mono body(Object producer, ParameterizedTypeReference elementType) { + public Mono body(Object producer, ParameterizedTypeReference elementTypeRef) { return new DefaultEntityResponseBuilder<>(producer, - BodyInserters.fromProducer(producer, elementType)) + BodyInserters.fromProducer(producer, elementTypeRef)) .status(this.statusCode) .headers(this.headers) .cookies(cookies -> cookies.addAll(this.cookies)) @@ -272,9 +272,9 @@ class DefaultServerResponseBuilder implements ServerResponse.BodyBuilder { @Override public > Mono body(P publisher, - ParameterizedTypeReference elementType) { + ParameterizedTypeReference elementTypeRef) { return new DefaultEntityResponseBuilder<>(publisher, - BodyInserters.fromPublisher(publisher, elementType)) + BodyInserters.fromPublisher(publisher, elementTypeRef)) .status(this.statusCode) .headers(this.headers) .cookies(cookies -> cookies.addAll(this.cookies)) diff --git a/spring-webflux/src/main/java/org/springframework/web/reactive/function/server/ServerResponse.java b/spring-webflux/src/main/java/org/springframework/web/reactive/function/server/ServerResponse.java index 41a2fce19b..eb07007a7c 100644 --- a/spring-webflux/src/main/java/org/springframework/web/reactive/function/server/ServerResponse.java +++ b/spring-webflux/src/main/java/org/springframework/web/reactive/function/server/ServerResponse.java @@ -418,11 +418,11 @@ public interface ServerResponse { * @param producer the producer to write to the response. This must be a * {@link Publisher} or another producer adaptable to a * {@code Publisher} via {@link ReactiveAdapterRegistry} - * @param typeReference a type reference describing the elements contained in the producer + * @param elementTypeRef a type reference describing the elements contained in the producer * @return the built response * @since 5.2 */ - Mono body(Object producer, ParameterizedTypeReference typeReference); + Mono body(Object producer, ParameterizedTypeReference elementTypeRef); /** * Set the body of the response to the given asynchronous {@code Publisher} and return it. @@ -441,13 +441,13 @@ public interface ServerResponse { * This convenience method combines {@link #body(BodyInserter)} and * {@link BodyInserters#fromPublisher(Publisher, ParameterizedTypeReference)}. * @param publisher the {@code Publisher} to write to the response - * @param typeReference a type reference describing the elements contained in the publisher + * @param elementTypeRef a type reference describing the elements contained in the publisher * @param the type of the elements contained in the publisher * @param

the type of the {@code Publisher} * @return the built response */ > Mono body(P publisher, - ParameterizedTypeReference typeReference); + ParameterizedTypeReference elementTypeRef); /** * Set the body of the response to the given {@code BodyInserter} and return it.