Class RestApi.Builder<B extends RestApi.Builder<B,T>,T extends RestApi>
java.lang.Object
io.helidon.integrations.common.rest.RestApi.Builder<B,T>
- Type Parameters:
B
- type of the builder (a subclass of this class)T
- type of the builtRestApi
- Direct Known Subclasses:
VaultRestApi.BuilderBase
- Enclosing interface:
- RestApi
public abstract static class RestApi.Builder<B extends RestApi.Builder<B,T>,T extends RestApi>
extends Object
implements Builder<B,T>
Base builder for REST APIs.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfinal T
build()
Configure this builder from config.protected abstract T
doBuild()
Build an instance ofRestApi
implementation.faultTolerance
(FtHandler ftHandler) Configure the fault tolerance handler to use with client requests.protected FtHandler
Configured Fault tolerance handler.final T
get()
protected JsonBuilderFactory
JSON builder factory.protected JsonReaderFactory
JSON reader factory.protected JsonWriterFactory
JSON writer factory.protected B
me()
Allows returning the correct type when subclassing.protected void
Post build method.protected void
preBuild()
Pre build method.protected WebClient
WebClient instance, available afterpostBuild()
is called.webClientBuilder
(Consumer<WebClient.Builder> updater) Update web client builder.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
build
-
get
-
config
Configure this builder from config. Useswebclient
key to configure theWebClient
builder, andjsonp
key to configure the JSON factories.- Parameters:
config
- configuration on the node of this rest API- Returns:
- updated builder
-
faultTolerance
Configure the fault tolerance handler to use with client requests.- Parameters:
ftHandler
- fault tolerance handler- Returns:
- updated builder
-
webClientBuilder
Update web client builder. This can be used to configureWebClient.Builder.connectTimeout(long, java.util.concurrent.TimeUnit)
,WebClient.Builder.readTimeout(long, java.util.concurrent.TimeUnit)
and other options.- Parameters:
updater
- consumer that updates the web client builder- Returns:
- updated builder instance
-
me
Allows returning the correct type when subclassing.- Returns:
- this instance typed as subclass
-
preBuild
protected void preBuild()Pre build method. This implementation builds the web client and sets up JSON factories. -
postBuild
protected void postBuild()Post build method. This implementation does nothing -
doBuild
Build an instance ofRestApi
implementation.- Returns:
- a new instance
-
webClient
WebClient instance, available afterpostBuild()
is called.- Returns:
- web client
-
ftHandler
Configured Fault tolerance handler.- Returns:
- handler
-
jsonBuilderFactory
JSON builder factory.- Returns:
- builder factory
-
jsonReaderFactory
JSON reader factory.- Returns:
- reader factory
-
jsonWriterFactory
JSON writer factory.- Returns:
- writer factory
-