Package ratpack.retrofit
Class RatpackRetrofit.Builder
- java.lang.Object
-
- ratpack.retrofit.RatpackRetrofit.Builder
-
- Enclosing class:
- RatpackRetrofit
public static class RatpackRetrofit.Builder extends java.lang.Object
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> Tbuild(java.lang.Class<T> service)Uses this builder to create a Retrofit client implementation.RatpackRetrofit.Builderconfigure(Action<? super Retrofit.Builder> builderAction)Configure the underlyingRetrofit.Builderinstance.RatpackRetrofit.BuilderhttpClient(Factory<? extends HttpClient> clientFactory)Configures aFactorythat supplies the underlyingHttpClientto back client interfaces generated from the return ofretrofit()Retrofitretrofit()Creates the underlyingRetrofitinstance and configures it to interface withHttpClientandPromise.
-
-
-
Method Detail
-
configure
public RatpackRetrofit.Builder configure(Action<? super Retrofit.Builder> builderAction)
Configure the underlyingRetrofit.Builderinstance.This is used to customize the behavior of Retrofit.
- Parameters:
builderAction- the actions to apply to the Retrofit builder- Returns:
this- See Also:
Converter.Factory,CallAdapter.Factory
-
httpClient
public RatpackRetrofit.Builder httpClient(Factory<? extends HttpClient> clientFactory)
Configures aFactorythat supplies the underlyingHttpClientto back client interfaces generated from the return ofretrofit()By default, the following locations are searched in order, with the first
HttpClientfound used to back the client interfaces.If no
HttpClientis found, aNotInRegistryExceptionis thrown.- Parameters:
clientFactory- a factory that generates a HttpClient to be used- Returns:
this- Since:
- 1.6
-
retrofit
public Retrofit retrofit()
Creates the underlyingRetrofitinstance and configures it to interface withHttpClientandPromise.The resulting Retrofit instance can be re-used to generate multiple client interfaces which share the same base URI.
- Returns:
- the Retrofit instance to create client interfaces
-
build
public <T> T build(java.lang.Class<T> service)
Uses this builder to create a Retrofit client implementation.This is the short form of calling
builder.retrofit().create(service).- Type Parameters:
T- the type of the client interface.- Parameters:
service- the client interface to generate.- Returns:
- a generated instance of the client interface.
-
-