diff --git a/spring-graphql/src/main/java/org/springframework/graphql/GraphQlRequest.java b/spring-graphql/src/main/java/org/springframework/graphql/GraphQlRequest.java
index 84062e67..0e979209 100644
--- a/spring-graphql/src/main/java/org/springframework/graphql/GraphQlRequest.java
+++ b/spring-graphql/src/main/java/org/springframework/graphql/GraphQlRequest.java
@@ -61,7 +61,7 @@ public interface GraphQlRequest {
/**
* Convert the request to a {@link Map} as defined in
* GraphQL over HTTP and
- * GraphQL over WebSocket:
+ * GraphQL over WebSocket.
*
*
Key
Value
*
query
{@link #getDocument() document}
diff --git a/spring-graphql/src/main/java/org/springframework/graphql/ResponseError.java b/spring-graphql/src/main/java/org/springframework/graphql/ResponseError.java
index b30898ff..10297819 100644
--- a/spring-graphql/src/main/java/org/springframework/graphql/ResponseError.java
+++ b/spring-graphql/src/main/java/org/springframework/graphql/ResponseError.java
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2020-2024 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.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.springframework.graphql;
import java.util.List;
diff --git a/spring-graphql/src/main/java/org/springframework/graphql/ResponseField.java b/spring-graphql/src/main/java/org/springframework/graphql/ResponseField.java
index 5f0b3e6f..cd681ffe 100644
--- a/spring-graphql/src/main/java/org/springframework/graphql/ResponseField.java
+++ b/spring-graphql/src/main/java/org/springframework/graphql/ResponseField.java
@@ -43,7 +43,7 @@ public interface ResponseField {
*
* @deprecated as of 1.0.3 in favor of checking via {@link #getValue()}
*/
- @Deprecated
+ @Deprecated(since = "1.0.3", forRemoval = true)
boolean hasValue();
/**
@@ -90,7 +90,7 @@ public interface ResponseField {
* @deprecated since 1.0.3 in favor of {@link #getErrors()}
*/
@Nullable
- @Deprecated
+ @Deprecated(since = "1.0.3", forRemoval = true)
ResponseError getError();
/**
diff --git a/spring-graphql/src/main/java/org/springframework/graphql/client/AbstractGraphQlClientBuilder.java b/spring-graphql/src/main/java/org/springframework/graphql/client/AbstractGraphQlClientBuilder.java
index 9ecb158a..f1367d4c 100644
--- a/spring-graphql/src/main/java/org/springframework/graphql/client/AbstractGraphQlClientBuilder.java
+++ b/spring-graphql/src/main/java/org/springframework/graphql/client/AbstractGraphQlClientBuilder.java
@@ -46,6 +46,7 @@ import org.springframework.util.ClassUtils;
* agnostic {@code GraphQlClient}. A transport specific extension can then wrap
* this default tester by extending {@link AbstractDelegatingGraphQlClient}.
*
+ * @param the builder type
* @author Rossen Stoyanchev
* @since 1.0.0
* @see AbstractDelegatingGraphQlClient
@@ -114,6 +115,8 @@ public abstract class AbstractGraphQlClientBuilder encoder, Decoder> decoder) {
this.jsonEncoder = encoder;
@@ -122,6 +125,7 @@ public abstract class AbstractGraphQlClientBuilder encoder) {
this.jsonEncoder = encoder;
@@ -137,6 +141,7 @@ public abstract class AbstractGraphQlClientBuilder decoder) {
this.jsonDecoder = decoder;
@@ -161,12 +166,13 @@ public abstract class AbstractGraphQlClientBuilder> getBuilderInitializer() {
- return builder -> {
- builder.interceptors(interceptorList -> interceptorList.addAll(interceptors));
- builder.documentSource(documentSource);
+ return (builder) -> {
+ builder.interceptors((interceptorList) -> interceptorList.addAll(this.interceptors));
+ builder.documentSource(this.documentSource);
builder.setJsonCodecs(getEncoder(), getDecoder());
};
}
private Chain createExecuteChain(GraphQlTransport transport) {
- Chain chain = request -> transport.execute(request).map(response ->
+ Chain chain = (request) -> transport.execute(request).map((response) ->
new DefaultClientGraphQlResponse(request, response, getEncoder(), getDecoder()));
return this.interceptors.stream()
.reduce(GraphQlClientInterceptor::andThen)
- .map(interceptor -> (Chain) (request) -> interceptor.intercept(request, chain))
+ .map((interceptor) -> (Chain) (request) -> interceptor.intercept(request, chain))
.orElse(chain);
}
private SubscriptionChain createExecuteSubscriptionChain(GraphQlTransport transport) {
- SubscriptionChain chain = request -> transport.executeSubscription(request)
- .map(response -> new DefaultClientGraphQlResponse(request, response, getEncoder(), getDecoder()));
+ SubscriptionChain chain = (request) -> transport.executeSubscription(request)
+ .map((response) -> new DefaultClientGraphQlResponse(request, response, getEncoder(), getDecoder()));
return this.interceptors.stream()
.reduce(GraphQlClientInterceptor::andThen)
- .map(interceptor -> (SubscriptionChain) (request) -> interceptor.interceptSubscription(request, chain))
+ .map((interceptor) -> (SubscriptionChain) (request) -> interceptor.interceptSubscription(request, chain))
.orElse(chain);
}
diff --git a/spring-graphql/src/main/java/org/springframework/graphql/client/ClientGraphQlResponse.java b/spring-graphql/src/main/java/org/springframework/graphql/client/ClientGraphQlResponse.java
index a43c29c2..0824975b 100644
--- a/spring-graphql/src/main/java/org/springframework/graphql/client/ClientGraphQlResponse.java
+++ b/spring-graphql/src/main/java/org/springframework/graphql/client/ClientGraphQlResponse.java
@@ -32,10 +32,12 @@ public interface ClientGraphQlResponse extends GraphQlResponse {
/**
* {@inheritDoc}
*/
+ @Override
ClientResponseField field(String path);
/**
* Decode the full response map to the given target type.
+ * @param the target type
* @param type the target class
* @return the decoded value, or never {@code null}
* @throws FieldAccessException if the response is not {@link #isValid() valid}
@@ -44,7 +46,8 @@ public interface ClientGraphQlResponse extends GraphQlResponse {
/**
* Variant of {@link #toEntity(Class)} with a {@link ParameterizedTypeReference}.
- * @param type the target type
+ * @param the target type
+ * @param type the target parameterized type
* @return the decoded value, or never {@code null}
* @throws FieldAccessException if the response is not {@link #isValid() valid}
*/
diff --git a/spring-graphql/src/main/java/org/springframework/graphql/client/ClientResponseField.java b/spring-graphql/src/main/java/org/springframework/graphql/client/ClientResponseField.java
index 8d7ef9a9..66b5146d 100644
--- a/spring-graphql/src/main/java/org/springframework/graphql/client/ClientResponseField.java
+++ b/spring-graphql/src/main/java/org/springframework/graphql/client/ClientResponseField.java
@@ -34,6 +34,7 @@ public interface ClientResponseField extends ResponseField {
/**
* Decode the field to an entity of the given type.
+ * @param the entity type
* @param entityType the type to convert to
* @return the decoded entity, or {@code null} if the field is {@code null}
* but otherwise there are no errors
@@ -46,12 +47,15 @@ public interface ClientResponseField extends ResponseField {
/**
* Variant of {@link #toEntity(Class)} with a {@link ParameterizedTypeReference}.
+ * @param the entity type
+ * @param entityType the type to convert to
*/
@Nullable
D toEntity(ParameterizedTypeReference entityType);
/**
* Variant of {@link #toEntity(Class)} to decode to a list of entities.
+ * @param the entity type
* @param elementType the type of elements in the list
* @return the list of decoded entities, or an empty list if the field is
* {@code null} but otherwise there are no errors
@@ -61,15 +65,16 @@ public interface ClientResponseField extends ResponseField {
*/
List toEntityList(Class elementType);
- /**
- * Variant of {@link #toEntity(Class)} to decode to a list of entities.
- * @param elementType the type of elements in the list
- * @return the list of decoded entities, or an empty list if the field is
- * {@code null} but otherwise there are no errors
- * @throws FieldAccessException if the target field is {@code null} and the
- * response is not {@link GraphQlResponse#isValid() valid} or the field has
- * {@link ResponseField#getErrors() errors}.
- */
+ /**
+ * Variant of {@link #toEntity(Class)} to decode to a list of entities.
+ * @param the entity type
+ * @param elementType the type of elements in the list
+ * @return the list of decoded entities, or an empty list if the field is
+ * {@code null} but otherwise there are no errors
+ * @throws FieldAccessException if the target field is {@code null} and the
+ * response is not {@link GraphQlResponse#isValid() valid} or the field has
+ * {@link ResponseField#getErrors() errors}.
+ */
List toEntityList(ParameterizedTypeReference elementType);
}
diff --git a/spring-graphql/src/main/java/org/springframework/graphql/client/CodecDelegate.java b/spring-graphql/src/main/java/org/springframework/graphql/client/CodecDelegate.java
index 6f433c78..841f1219 100644
--- a/spring-graphql/src/main/java/org/springframework/graphql/client/CodecDelegate.java
+++ b/spring-graphql/src/main/java/org/springframework/graphql/client/CodecDelegate.java
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.springframework.graphql.client;
import java.util.List;
@@ -37,7 +38,6 @@ import org.springframework.web.reactive.socket.WebSocketSession;
* Helper class for encoding and decoding GraphQL messages.
*
* @author Rossen Stoyanchev
- * @since 1.0.0
*/
final class CodecDelegate {
@@ -60,14 +60,14 @@ final class CodecDelegate {
static Encoder> findJsonEncoder(CodecConfigurer configurer) {
return findJsonEncoder(configurer.getWriters().stream()
- .filter(writer -> writer instanceof EncoderHttpMessageWriter)
- .map(writer -> ((EncoderHttpMessageWriter>) writer).getEncoder()));
+ .filter((writer) -> writer instanceof EncoderHttpMessageWriter)
+ .map((writer) -> ((EncoderHttpMessageWriter>) writer).getEncoder()));
}
static Decoder> findJsonDecoder(CodecConfigurer configurer) {
return findJsonDecoder(configurer.getReaders().stream()
- .filter(reader -> reader instanceof DecoderHttpMessageReader)
- .map(reader -> ((DecoderHttpMessageReader>) reader).getDecoder()));
+ .filter((reader) -> reader instanceof DecoderHttpMessageReader)
+ .map((reader) -> ((DecoderHttpMessageReader>) reader).getDecoder()));
}
static Encoder> findJsonEncoder(List> encoders) {
@@ -80,26 +80,26 @@ final class CodecDelegate {
private static Encoder> findJsonEncoder(Stream> stream) {
return stream
- .filter(encoder -> encoder.canEncode(MESSAGE_TYPE, MediaType.APPLICATION_JSON))
+ .filter((encoder) -> encoder.canEncode(MESSAGE_TYPE, MediaType.APPLICATION_JSON))
.findFirst()
.orElseThrow(() -> new IllegalArgumentException("No JSON Encoder"));
}
private static Decoder> findJsonDecoder(Stream> decoderStream) {
return decoderStream
- .filter(decoder -> decoder.canDecode(MESSAGE_TYPE, MediaType.APPLICATION_JSON))
+ .filter((decoder) -> decoder.canDecode(MESSAGE_TYPE, MediaType.APPLICATION_JSON))
.findFirst()
.orElseThrow(() -> new IllegalArgumentException("No JSON Decoder"));
}
- public CodecConfigurer getCodecConfigurer() {
+ CodecConfigurer getCodecConfigurer() {
return this.codecConfigurer;
}
@SuppressWarnings("unchecked")
- public WebSocketMessage encode(WebSocketSession session, GraphQlWebSocketMessage message) {
+ WebSocketMessage encode(WebSocketSession session, GraphQlWebSocketMessage message) {
DataBuffer buffer = ((Encoder) this.encoder).encodeValue(
(T) message, session.bufferFactory(), MESSAGE_TYPE, MimeTypeUtils.APPLICATION_JSON, null);
@@ -108,7 +108,7 @@ final class CodecDelegate {
}
@SuppressWarnings("ConstantConditions")
- public GraphQlWebSocketMessage decode(WebSocketMessage webSocketMessage) {
+ GraphQlWebSocketMessage decode(WebSocketMessage webSocketMessage) {
DataBuffer buffer = DataBufferUtils.retain(webSocketMessage.getPayload());
return (GraphQlWebSocketMessage) this.decoder.decode(buffer, MESSAGE_TYPE, null, null);
}
diff --git a/spring-graphql/src/main/java/org/springframework/graphql/client/DefaultClientGraphQlRequest.java b/spring-graphql/src/main/java/org/springframework/graphql/client/DefaultClientGraphQlRequest.java
index ad576e45..8f0e6c83 100644
--- a/spring-graphql/src/main/java/org/springframework/graphql/client/DefaultClientGraphQlRequest.java
+++ b/spring-graphql/src/main/java/org/springframework/graphql/client/DefaultClientGraphQlRequest.java
@@ -27,7 +27,6 @@ import org.springframework.lang.Nullable;
* Default implementation of {@link ClientGraphQlRequest}.
*
* @author Rossen Stoyanchev
- * @since 1.0.0
*/
final class DefaultClientGraphQlRequest extends DefaultGraphQlRequest implements ClientGraphQlRequest {
diff --git a/spring-graphql/src/main/java/org/springframework/graphql/client/DefaultClientGraphQlResponse.java b/spring-graphql/src/main/java/org/springframework/graphql/client/DefaultClientGraphQlResponse.java
index 18a5ad4c..90bb57cb 100644
--- a/spring-graphql/src/main/java/org/springframework/graphql/client/DefaultClientGraphQlResponse.java
+++ b/spring-graphql/src/main/java/org/springframework/graphql/client/DefaultClientGraphQlResponse.java
@@ -26,7 +26,6 @@ import org.springframework.graphql.GraphQlResponse;
* Default implementation of {@link ClientGraphQlResponse}.
*
* @author Rossen Stoyanchev
- * @since 1.0.0
*/
final class DefaultClientGraphQlResponse extends ResponseMapGraphQlResponse implements ClientGraphQlResponse {
diff --git a/spring-graphql/src/main/java/org/springframework/graphql/client/DefaultClientResponseField.java b/spring-graphql/src/main/java/org/springframework/graphql/client/DefaultClientResponseField.java
index 44646250..c0aa2689 100644
--- a/spring-graphql/src/main/java/org/springframework/graphql/client/DefaultClientResponseField.java
+++ b/spring-graphql/src/main/java/org/springframework/graphql/client/DefaultClientResponseField.java
@@ -40,7 +40,6 @@ import org.springframework.util.MimeTypeUtils;
* support for decoding.
*
* @author Rossen Stoyanchev
- * @since 1.0.0
*/
final class DefaultClientResponseField implements ClientResponseField {
@@ -55,7 +54,7 @@ final class DefaultClientResponseField implements ClientResponseField {
}
- @SuppressWarnings("deprecation")
+ @SuppressWarnings("removal")
@Override
public boolean hasValue() {
return (this.field.getValue() != null);
@@ -76,7 +75,7 @@ final class DefaultClientResponseField implements ClientResponseField {
return this.field.getValue();
}
- @SuppressWarnings("deprecation")
+ @SuppressWarnings("removal")
@Override
public ResponseError getError() {
return this.field.getError();
@@ -100,13 +99,13 @@ final class DefaultClientResponseField implements ClientResponseField {
@Override
public List toEntityList(Class elementType) {
List list = toEntity(ResolvableType.forClassWithGenerics(List.class, elementType));
- return (list != null ? list : Collections.emptyList());
+ return (list != null) ? list : Collections.emptyList();
}
@Override
public List toEntityList(ParameterizedTypeReference elementType) {
List list = toEntity(ResolvableType.forClassWithGenerics(List.class, ResolvableType.forType(elementType)));
- return (list != null ? list : Collections.emptyList());
+ return (list != null) ? list : Collections.emptyList();
}
@SuppressWarnings("unchecked")
diff --git a/spring-graphql/src/main/java/org/springframework/graphql/client/DefaultGraphQlClient.java b/spring-graphql/src/main/java/org/springframework/graphql/client/DefaultGraphQlClient.java
index a43e4a44..79809afe 100644
--- a/spring-graphql/src/main/java/org/springframework/graphql/client/DefaultGraphQlClient.java
+++ b/spring-graphql/src/main/java/org/springframework/graphql/client/DefaultGraphQlClient.java
@@ -34,7 +34,6 @@ import org.springframework.util.Assert;
* Default, final {@link GraphQlClient} implementation for use with any transport.
*
* @author Rossen Stoyanchev
- * @since 1.0.0
*/
final class DefaultGraphQlClient implements GraphQlClient {
@@ -155,22 +154,22 @@ final class DefaultGraphQlClient implements GraphQlClient {
@Override
public Mono execute() {
- return initRequest().flatMap(request -> executeChain.next(request)
+ return initRequest().flatMap((request) -> DefaultGraphQlClient.this.executeChain.next(request)
.onErrorResume(
- ex -> !(ex instanceof GraphQlClientException),
- ex -> Mono.error(new GraphQlTransportException(ex, request))));
+ (ex) -> !(ex instanceof GraphQlClientException),
+ (ex) -> Mono.error(new GraphQlTransportException(ex, request))));
}
@Override
public Flux executeSubscription() {
- return initRequest().flatMapMany(request -> executeSubscriptionChain.next(request)
+ return initRequest().flatMapMany((request) -> DefaultGraphQlClient.this.executeSubscriptionChain.next(request)
.onErrorResume(
- ex -> !(ex instanceof GraphQlClientException),
- ex -> Mono.error(new GraphQlTransportException(ex, request))));
+ (ex) -> !(ex instanceof GraphQlClientException),
+ (ex) -> Mono.error(new GraphQlTransportException(ex, request))));
}
private Mono initRequest() {
- return this.documentMono.map(document ->
+ return this.documentMono.map((document) ->
new DefaultClientGraphQlRequest(document, this.operationName, this.variables, this.extensions, this.attributes));
}
@@ -198,7 +197,7 @@ final class DefaultGraphQlClient implements GraphQlClient {
throw new FieldAccessException(
((DefaultClientGraphQlResponse) response).getRequest(), response, field);
}
- return (field.getValue() != null ? field : null);
+ return (field.getValue() != null) ? field : null;
}
}
@@ -215,27 +214,27 @@ final class DefaultGraphQlClient implements GraphQlClient {
@Override
public Mono toEntity(Class entityType) {
- return this.responseMono.mapNotNull(this::getValidField).mapNotNull(field -> field.toEntity(entityType));
+ return this.responseMono.mapNotNull(this::getValidField).mapNotNull((field) -> field.toEntity(entityType));
}
@Override
public Mono toEntity(ParameterizedTypeReference entityType) {
- return this.responseMono.mapNotNull(this::getValidField).mapNotNull(field -> field.toEntity(entityType));
+ return this.responseMono.mapNotNull(this::getValidField).mapNotNull((field) -> field.toEntity(entityType));
}
@Override
public Mono> toEntityList(Class elementType) {
- return this.responseMono.map(response -> {
+ return this.responseMono.map((response) -> {
ClientResponseField field = getValidField(response);
- return (field != null ? field.toEntityList(elementType) : Collections.emptyList());
+ return (field != null) ? field.toEntityList(elementType) : Collections.emptyList();
});
}
@Override
public Mono> toEntityList(ParameterizedTypeReference elementType) {
- return this.responseMono.map(response -> {
+ return this.responseMono.map((response) -> {
ClientResponseField field = getValidField(response);
- return (field != null ? field.toEntityList(elementType) : Collections.emptyList());
+ return (field != null) ? field.toEntityList(elementType) : Collections.emptyList();
});
}
@@ -253,27 +252,27 @@ final class DefaultGraphQlClient implements GraphQlClient {
@Override
public Flux toEntity(Class entityType) {
- return this.responseFlux.mapNotNull(this::getValidField).mapNotNull(field -> field.toEntity(entityType));
+ return this.responseFlux.mapNotNull(this::getValidField).mapNotNull((field) -> field.toEntity(entityType));
}
@Override
public Flux toEntity(ParameterizedTypeReference entityType) {
- return this.responseFlux.mapNotNull(this::getValidField).mapNotNull(field -> field.toEntity(entityType));
+ return this.responseFlux.mapNotNull(this::getValidField).mapNotNull((field) -> field.toEntity(entityType));
}
@Override
public Flux> toEntityList(Class elementType) {
- return this.responseFlux.map(response -> {
+ return this.responseFlux.map((response) -> {
ClientResponseField field = getValidField(response);
- return (field != null ? field.toEntityList(elementType) : Collections.emptyList());
+ return (field != null) ? field.toEntityList(elementType) : Collections.emptyList();
});
}
@Override
public Flux> toEntityList(ParameterizedTypeReference elementType) {
- return this.responseFlux.map(response -> {
+ return this.responseFlux.map((response) -> {
ClientResponseField field = getValidField(response);
- return (field != null ? field.toEntityList(elementType) : Collections.emptyList());
+ return (field != null) ? field.toEntityList(elementType) : Collections.emptyList();
});
}
diff --git a/spring-graphql/src/main/java/org/springframework/graphql/client/DefaultHttpGraphQlClientBuilder.java b/spring-graphql/src/main/java/org/springframework/graphql/client/DefaultHttpGraphQlClientBuilder.java
index f2e4f38d..7041fea4 100644
--- a/spring-graphql/src/main/java/org/springframework/graphql/client/DefaultHttpGraphQlClientBuilder.java
+++ b/spring-graphql/src/main/java/org/springframework/graphql/client/DefaultHttpGraphQlClientBuilder.java
@@ -33,7 +33,6 @@ import org.springframework.web.util.UriComponentsBuilder;
* around a {@link WebClient.Builder}.
*
* @author Rossen Stoyanchev
- * @since 1.0.0
*/
final class DefaultHttpGraphQlClientBuilder
extends AbstractGraphQlClientBuilder
@@ -105,7 +104,7 @@ final class DefaultHttpGraphQlClientBuilder
public HttpGraphQlClient build() {
// Pass the codecs to the parent for response decoding
- this.webClientBuilder.codecs(configurer ->
+ this.webClientBuilder.codecs((configurer) ->
setJsonCodecs(
CodecDelegate.findJsonEncoder(configurer),
CodecDelegate.findJsonDecoder(configurer)));
@@ -139,6 +138,7 @@ final class DefaultHttpGraphQlClientBuilder
this.builderInitializer = builderInitializer;
}
+ @Override
public DefaultHttpGraphQlClientBuilder mutate() {
DefaultHttpGraphQlClientBuilder builder = new DefaultHttpGraphQlClientBuilder(this.webClient);
this.builderInitializer.accept(builder);
diff --git a/spring-graphql/src/main/java/org/springframework/graphql/client/DefaultRSocketGraphQlClientBuilder.java b/spring-graphql/src/main/java/org/springframework/graphql/client/DefaultRSocketGraphQlClientBuilder.java
index 0dc645d4..68e6fe0a 100644
--- a/spring-graphql/src/main/java/org/springframework/graphql/client/DefaultRSocketGraphQlClientBuilder.java
+++ b/spring-graphql/src/main/java/org/springframework/graphql/client/DefaultRSocketGraphQlClientBuilder.java
@@ -41,7 +41,6 @@ import org.springframework.util.MimeTypeUtils;
* a {@link RSocketRequester.Builder}.
*
* @author Rossen Stoyanchev
- * @since 1.0.0
*/
final class DefaultRSocketGraphQlClientBuilder
extends AbstractGraphQlClientBuilder
@@ -134,9 +133,9 @@ final class DefaultRSocketGraphQlClientBuilder
public RSocketGraphQlClient build() {
// Pass the codecs to the parent for response decoding
- this.requesterBuilder.rsocketStrategies(builder -> {
- builder.decoders(decoders -> setJsonDecoder(CodecDelegate.findJsonDecoder(decoders)));
- builder.encoders(encoders -> setJsonEncoder(CodecDelegate.findJsonEncoder(encoders)));
+ this.requesterBuilder.rsocketStrategies((builder) -> {
+ builder.decoders((decoders) -> setJsonDecoder(CodecDelegate.findJsonDecoder(decoders)));
+ builder.encoders((encoders) -> setJsonEncoder(CodecDelegate.findJsonEncoder(encoders)));
});
RSocketRequester requester;
diff --git a/spring-graphql/src/main/java/org/springframework/graphql/client/DefaultTransportGraphQlClientBuilder.java b/spring-graphql/src/main/java/org/springframework/graphql/client/DefaultTransportGraphQlClientBuilder.java
index 86d49925..29dc8113 100644
--- a/spring-graphql/src/main/java/org/springframework/graphql/client/DefaultTransportGraphQlClientBuilder.java
+++ b/spring-graphql/src/main/java/org/springframework/graphql/client/DefaultTransportGraphQlClientBuilder.java
@@ -26,7 +26,6 @@ import org.springframework.util.Assert;
* Default {@link GraphQlClient.Builder} with a given, externally, prepared transport.
*
* @author Rossen Stoyanchev
- * @since 1.0.0
*/
final class DefaultTransportGraphQlClientBuilder
extends AbstractGraphQlClientBuilder {
diff --git a/spring-graphql/src/main/java/org/springframework/graphql/client/DefaultWebSocketGraphQlClientBuilder.java b/spring-graphql/src/main/java/org/springframework/graphql/client/DefaultWebSocketGraphQlClientBuilder.java
index 90204385..7d303850 100644
--- a/spring-graphql/src/main/java/org/springframework/graphql/client/DefaultWebSocketGraphQlClientBuilder.java
+++ b/spring-graphql/src/main/java/org/springframework/graphql/client/DefaultWebSocketGraphQlClientBuilder.java
@@ -20,7 +20,6 @@ import java.net.URI;
import java.util.Arrays;
import java.util.List;
import java.util.function.Consumer;
-import java.util.stream.Collectors;
import reactor.core.publisher.Mono;
@@ -37,7 +36,6 @@ import org.springframework.web.util.DefaultUriBuilderFactory;
* {@code WebSocketGraphQlTransport}.
*
* @author Rossen Stoyanchev
- * @since 1.0.0
*/
final class DefaultWebSocketGraphQlClientBuilder
extends AbstractGraphQlClientBuilder
@@ -130,14 +128,14 @@ final class DefaultWebSocketGraphQlClientBuilder
private WebSocketGraphQlClientInterceptor getInterceptor() {
List interceptors = getInterceptors().stream()
- .filter(interceptor -> interceptor instanceof WebSocketGraphQlClientInterceptor)
- .map(interceptor -> (WebSocketGraphQlClientInterceptor) interceptor)
+ .filter((interceptor) -> interceptor instanceof WebSocketGraphQlClientInterceptor)
+ .map((interceptor) -> (WebSocketGraphQlClientInterceptor) interceptor)
.toList();
Assert.state(interceptors.size() <= 1,
"Only a single interceptor of type WebSocketGraphQlClientInterceptor may be configured");
- return (!interceptors.isEmpty() ? interceptors.get(0) : new WebSocketGraphQlClientInterceptor() {});
+ return (!interceptors.isEmpty() ? interceptors.get(0) : new WebSocketGraphQlClientInterceptor() { });
}
diff --git a/spring-graphql/src/main/java/org/springframework/graphql/client/FieldAccessException.java b/spring-graphql/src/main/java/org/springframework/graphql/client/FieldAccessException.java
index 6bddc787..4c6cb60e 100644
--- a/spring-graphql/src/main/java/org/springframework/graphql/client/FieldAccessException.java
+++ b/spring-graphql/src/main/java/org/springframework/graphql/client/FieldAccessException.java
@@ -38,6 +38,9 @@ public class FieldAccessException extends GraphQlClientException {
/**
* Constructor with the request and response, and the accessed field.
+ * @param request the client request
+ * @param response the client response
+ * @param field the accessed field that caused the error
*/
public FieldAccessException(
ClientGraphQlRequest request, ClientGraphQlResponse response, ClientResponseField field) {
diff --git a/spring-graphql/src/main/java/org/springframework/graphql/client/GraphQlClient.java b/spring-graphql/src/main/java/org/springframework/graphql/client/GraphQlClient.java
index 985f834d..6a2c6f7c 100644
--- a/spring-graphql/src/main/java/org/springframework/graphql/client/GraphQlClient.java
+++ b/spring-graphql/src/main/java/org/springframework/graphql/client/GraphQlClient.java
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.springframework.graphql.client;
import java.util.List;
@@ -61,6 +62,7 @@ public interface GraphQlClient {
* Variant of {@link #document(String)} that uses the given key to resolve
* the GraphQL document from a file with the help of the configured
* {@link Builder#documentSource(DocumentSource) DocumentSource}.
+ * @param name the document name
* @throws IllegalArgumentException if the content could not be loaded
*/
RequestSpec documentName(String name);
@@ -87,6 +89,7 @@ public interface GraphQlClient {
/**
* Defines a builder for creating {@link GraphQlClient} instances.
+ * @param the client builder type
*/
interface Builder> {
@@ -112,6 +115,7 @@ public interface GraphQlClient {
*
By default, this is set to {@link ResourceDocumentSource} with
* classpath location {@code "graphql-documents/"} and
* {@link ResourceDocumentSource#FILE_EXTENSIONS} as extensions.
+ * @param contentLoader the document source
*/
B documentSource(DocumentSource contentLoader);
@@ -190,6 +194,7 @@ public interface GraphQlClient {
*
+ * @param path the field path
* @return a spec with decoding options
* @throws FieldAccessException if the field has any field errors,
* including errors at, above or below the field path.
@@ -203,6 +208,7 @@ public interface GraphQlClient {
*
+ * @param path the field path
* @return a spec with decoding options
*/
RetrieveSubscriptionSpec retrieveSubscription(String path);
@@ -242,6 +248,7 @@ public interface GraphQlClient {
/**
* Decode the field to an entity of the given type.
+ * @param the entity type
* @param entityType the type to convert to
* @return {@code Mono} with the decoded entity; completes with
* {@link FieldAccessException} in case of {@link ResponseField field
@@ -253,17 +260,21 @@ public interface GraphQlClient {
/**
* Variant of {@link #toEntity(Class)} with a {@link ParameterizedTypeReference}.
+ * @param the entity type
+ * @param entityType the type to convert to
*/
Mono toEntity(ParameterizedTypeReference entityType);
/**
* Variant of {@link #toEntity(Class)} to decode to a List of entities.
+ * @param the entity type
* @param elementType the type of elements in the list
*/
Mono> toEntityList(Class elementType);
/**
* Variant of {@link #toEntity(Class)} to decode to a List of entities.
+ * @param the entity type
* @param elementType the type of elements in the list
*/
Mono> toEntityList(ParameterizedTypeReference elementType);
@@ -278,6 +289,7 @@ public interface GraphQlClient {
/**
* Decode the field to an entity of the given type.
+ * @param the entity type
* @param entityType the type to convert to
* @return {@code Mono} with the decoded entity; completes with
* {@link FieldAccessException} in case of {@link ResponseField field
@@ -289,20 +301,25 @@ public interface GraphQlClient {
/**
* Variant of {@link #toEntity(Class)} with a {@link ParameterizedTypeReference}.
+ * @param the entity type
+ * @param entityType the type to convert to
*/
Flux toEntity(ParameterizedTypeReference entityType);
/**
* Variant of {@link #toEntity(Class)} to decode each response to a List of entities.
+ * @param the entity type
* @param elementType the type of elements in the list
*/
Flux> toEntityList(Class elementType);
/**
* Variant of {@link #toEntity(Class)} to decode each response to a List of entities.
+ * @param the entity type
+ * @param elementType the type of elements in the list
*/
Flux> toEntityList(ParameterizedTypeReference elementType);
}
-}
\ No newline at end of file
+}
diff --git a/spring-graphql/src/main/java/org/springframework/graphql/client/GraphQlClientException.java b/spring-graphql/src/main/java/org/springframework/graphql/client/GraphQlClientException.java
index 543ad296..9cce8bce 100644
--- a/spring-graphql/src/main/java/org/springframework/graphql/client/GraphQlClientException.java
+++ b/spring-graphql/src/main/java/org/springframework/graphql/client/GraphQlClientException.java
@@ -36,6 +36,9 @@ public class GraphQlClientException extends NestedRuntimeException {
/**
* Constructor with a message, optional cause, and the request details.
+ * @param message the exception message to use
+ * @param cause the original cause for the client exception
+ * @param request the request that failed
*/
public GraphQlClientException(String message, @Nullable Throwable cause, GraphQlRequest request) {
super(message, cause);
diff --git a/spring-graphql/src/main/java/org/springframework/graphql/client/GraphQlClientInterceptor.java b/spring-graphql/src/main/java/org/springframework/graphql/client/GraphQlClientInterceptor.java
index a1b9597a..fda6bb57 100644
--- a/spring-graphql/src/main/java/org/springframework/graphql/client/GraphQlClientInterceptor.java
+++ b/spring-graphql/src/main/java/org/springframework/graphql/client/GraphQlClientInterceptor.java
@@ -65,13 +65,13 @@ public interface GraphQlClientInterceptor {
@Override
public Mono intercept(ClientGraphQlRequest request, Chain chain) {
return GraphQlClientInterceptor.this.intercept(
- request, nextRequest -> interceptor.intercept(nextRequest, chain));
+ request, (nextRequest) -> interceptor.intercept(nextRequest, chain));
}
@Override
public Flux interceptSubscription(ClientGraphQlRequest request, SubscriptionChain chain) {
return GraphQlClientInterceptor.this.interceptSubscription(
- request, nextRequest -> interceptor.interceptSubscription(nextRequest, chain));
+ request, (nextRequest) -> interceptor.interceptSubscription(nextRequest, chain));
}
};
}
diff --git a/spring-graphql/src/main/java/org/springframework/graphql/client/GraphQlTransport.java b/spring-graphql/src/main/java/org/springframework/graphql/client/GraphQlTransport.java
index 44b0a7a7..2afc67ed 100644
--- a/spring-graphql/src/main/java/org/springframework/graphql/client/GraphQlTransport.java
+++ b/spring-graphql/src/main/java/org/springframework/graphql/client/GraphQlTransport.java
@@ -63,6 +63,7 @@ public interface GraphQlTransport {
/**
* Factory method to create {@link GraphQlResponse} from a GraphQL response
* map for use in transport implementations.
+ * @param responseMap the GraphQL response map
*/
static GraphQlResponse createResponse(Map responseMap) {
return new ResponseMapGraphQlResponse(responseMap);
diff --git a/spring-graphql/src/main/java/org/springframework/graphql/client/GraphQlTransportException.java b/spring-graphql/src/main/java/org/springframework/graphql/client/GraphQlTransportException.java
index 8dca147e..e7f80067 100644
--- a/spring-graphql/src/main/java/org/springframework/graphql/client/GraphQlTransportException.java
+++ b/spring-graphql/src/main/java/org/springframework/graphql/client/GraphQlTransportException.java
@@ -32,6 +32,8 @@ public class GraphQlTransportException extends GraphQlClientException {
/**
* Constructor with a default message.
+ * @param cause the original cause of the transport error
+ * @param request the request that failed at the transport level
*/
public GraphQlTransportException(@Nullable Throwable cause, GraphQlRequest request) {
super("GraphQlTransport error: " + cause.getMessage(), cause, request);
@@ -39,6 +41,9 @@ public class GraphQlTransportException extends GraphQlClientException {
/**
* Constructor with a given message.
+ * @param message the exception message to use
+ * @param cause the original cause of the transport error
+ * @param request the request that failed at the transport level
*/
public GraphQlTransportException(String message, @Nullable Throwable cause, GraphQlRequest request) {
super(message, cause, request);
diff --git a/spring-graphql/src/main/java/org/springframework/graphql/client/HttpGraphQlClient.java b/spring-graphql/src/main/java/org/springframework/graphql/client/HttpGraphQlClient.java
index 72c6505c..82734771 100644
--- a/spring-graphql/src/main/java/org/springframework/graphql/client/HttpGraphQlClient.java
+++ b/spring-graphql/src/main/java/org/springframework/graphql/client/HttpGraphQlClient.java
@@ -36,6 +36,7 @@ public interface HttpGraphQlClient extends WebGraphQlClient {
/**
* Create an {@link HttpGraphQlClient} that uses the given {@link WebClient}.
+ * @param webClient the {@code WebClient} to use for sending HTTP requests
*/
static HttpGraphQlClient create(WebClient webClient) {
return builder(webClient.mutate()).build();
@@ -51,6 +52,7 @@ public interface HttpGraphQlClient extends WebGraphQlClient {
/**
* Variant of {@link #builder()} with a pre-configured {@code WebClient}
* to mutate and customize further through the returned builder.
+ * @param webClient the {@code WebClient} to use for sending HTTP requests
*/
static Builder> builder(WebClient webClient) {
return builder(webClient.mutate());
@@ -59,6 +61,7 @@ public interface HttpGraphQlClient extends WebGraphQlClient {
/**
* Variant of {@link #builder()} with a pre-configured {@code WebClient}
* to mutate and customize further through the returned builder.
+ * @param webClientBuilder the {@code WebClient.Builder} to use for building the HTTP client
*/
static Builder> builder(WebClient.Builder webClientBuilder) {
return new DefaultHttpGraphQlClientBuilder(webClientBuilder);
@@ -67,6 +70,7 @@ public interface HttpGraphQlClient extends WebGraphQlClient {
/**
* Builder for the GraphQL over HTTP client.
+ * @param the builder type
*/
interface Builder> extends WebGraphQlClient.Builder {
@@ -74,6 +78,7 @@ public interface HttpGraphQlClient extends WebGraphQlClient {
* Customize the {@code WebClient} to use.
*
Note that some properties of {@code WebClient.Builder} like the
* base URL, headers, and codecs can be customized through this builder.
+ * @param webClient the function for customizing the {@code WebClient.Builder} that's used to build the HTTP client
* @see #url(String)
* @see #header(String, String...)
* @see #codecConfigurer(Consumer)
diff --git a/spring-graphql/src/main/java/org/springframework/graphql/client/HttpGraphQlTransport.java b/spring-graphql/src/main/java/org/springframework/graphql/client/HttpGraphQlTransport.java
index 70af28a9..98a0d871 100644
--- a/spring-graphql/src/main/java/org/springframework/graphql/client/HttpGraphQlTransport.java
+++ b/spring-graphql/src/main/java/org/springframework/graphql/client/HttpGraphQlTransport.java
@@ -37,12 +37,11 @@ import org.springframework.web.reactive.function.client.WebClient;
* see {@link WebSocketGraphQlTransport} and {@link RSocketGraphQlTransport}.
*
* @author Rossen Stoyanchev
- * @since 1.0.0
*/
final class HttpGraphQlTransport implements GraphQlTransport {
private static final ParameterizedTypeReference