Class AbstractGraphQlClientBuilder<B extends AbstractGraphQlClientBuilder<B>>
java.lang.Object
org.springframework.graphql.client.AbstractGraphQlClientBuilder<B>
- All Implemented Interfaces:
GraphQlClient.Builder<B>
public abstract class AbstractGraphQlClientBuilder<B extends AbstractGraphQlClientBuilder<B>>
extends Object
implements GraphQlClient.Builder<B>
Abstract, base class for transport specific
GraphQlClient.Builder
implementations.
Subclasses must implement GraphQlClient.Builder.build()
and call
buildGraphQlClient(GraphQlTransport)
to obtain a default, transport
agnostic GraphQlClient
. A transport specific extension can then wrap
this default tester by extending AbstractDelegatingGraphQlClient
.
- Since:
- 1.0.0
- Author:
- Rossen Stoyanchev
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionprotected static class
-
Field Summary
-
Constructor Summary
ModifierConstructorDescriptionprotected
Default constructor for use from subclasses. -
Method Summary
Modifier and TypeMethodDescriptionprotected GraphQlClient
buildGraphQlClient
(GraphQlTransport transport) Build the default transport-agnostic client that subclasses can then wrap withAbstractDelegatingGraphQlClient
.documentSource
(DocumentSource contentLoader) Configure aDocumentSource
for use withGraphQlClient.documentName(String)
for resolving a document by name.protected Consumer<AbstractGraphQlClientBuilder<?>>
Return aConsumer
to initialize new builders from "this" builder.protected List<GraphQlClientInterceptor>
Return the configured interceptors.protected Decoder<?>
Access to the configured JSON encoder.protected Encoder<?>
Access to the configured JSON encoder.interceptor
(GraphQlClientInterceptor... interceptors) Configure interceptors to be invoked before delegating to theGraphQlTransport
to perform the request.interceptors
(Consumer<List<GraphQlClientInterceptor>> interceptorsConsumer) Customize the list of interceptors.protected void
setJsonCodecs
(Encoder<?> encoder, Decoder<?> decoder) Transport-specific subclasses can provide their JSONEncoder
andDecoder
for use at the client level, for mapping response data to some target entity type.protected void
setJsonDecoder
(Decoder<?> decoder) Variant ofsetJsonCodecs(org.springframework.core.codec.Encoder<?>, org.springframework.core.codec.Decoder<?>)
for setting each codec individually.protected void
setJsonEncoder
(Encoder<?> encoder) Variant ofsetJsonCodecs(org.springframework.core.codec.Encoder<?>, org.springframework.core.codec.Decoder<?>)
for setting each codec individually.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.graphql.client.GraphQlClient.Builder
build
-
Field Details
-
jackson2Present
protected static final boolean jackson2Present
-
-
Constructor Details
-
AbstractGraphQlClientBuilder
protected AbstractGraphQlClientBuilder()Default constructor for use from subclasses.Subclasses must set the transport to use before
GraphQlClient.Builder.build()
or during, by overridingGraphQlClient.Builder.build()
.
-
-
Method Details
-
interceptor
Description copied from interface:GraphQlClient.Builder
Configure interceptors to be invoked before delegating to theGraphQlTransport
to perform the request.- Specified by:
interceptor
in interfaceGraphQlClient.Builder<B extends AbstractGraphQlClientBuilder<B>>
- Parameters:
interceptors
- the interceptors to add- Returns:
- this builder
-
interceptors
Description copied from interface:GraphQlClient.Builder
Customize the list of interceptors. The provided list is "live", so the consumer can inspect and insert interceptors accordingly.- Specified by:
interceptors
in interfaceGraphQlClient.Builder<B extends AbstractGraphQlClientBuilder<B>>
- Parameters:
interceptorsConsumer
- consumer to customize the interceptors with- Returns:
- this builder
-
documentSource
Description copied from interface:GraphQlClient.Builder
Configure aDocumentSource
for use withGraphQlClient.documentName(String)
for resolving a document by name.By default, this is set to
ResourceDocumentSource
with classpath location"graphql-documents/"
andResourceDocumentSource.FILE_EXTENSIONS
as extensions.- Specified by:
documentSource
in interfaceGraphQlClient.Builder<B extends AbstractGraphQlClientBuilder<B>>
-
setJsonCodecs
Transport-specific subclasses can provide their JSONEncoder
andDecoder
for use at the client level, for mapping response data to some target entity type. -
setJsonEncoder
Variant ofsetJsonCodecs(org.springframework.core.codec.Encoder<?>, org.springframework.core.codec.Decoder<?>)
for setting each codec individually. -
getJsonEncoder
Access to the configured JSON encoder. -
setJsonDecoder
Variant ofsetJsonCodecs(org.springframework.core.codec.Encoder<?>, org.springframework.core.codec.Decoder<?>)
for setting each codec individually. -
getJsonDecoder
Access to the configured JSON encoder. -
getInterceptors
Return the configured interceptors. For subclasses that look for a transport specific interceptor extensions. -
buildGraphQlClient
Build the default transport-agnostic client that subclasses can then wrap withAbstractDelegatingGraphQlClient
. -
getBuilderInitializer
Return aConsumer
to initialize new builders from "this" builder.
-