Class CallHttpApis.Builder
- java.lang.Object
-
- org.shakespeareframework.retrofit.CallHttpApis.Builder
-
- Enclosing class:
- CallHttpApis
public static class CallHttpApis.Builder extends java.lang.Object
Builder wrapping aRetrofit.Builder
and aOkHttpClient.Builder
to allow setting both with one class.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CallHttpApis.Builder
addConverterFactory(retrofit2.Converter.Factory converterFactory)
Adds the givenConverter.Factory
to theretrofitBuilder
.CallHttpApis.Builder
addInterceptor(okhttp3.Interceptor interceptor)
Adds the givenInterceptor
to theokHttpClientBuilder
.CallHttpApis.Builder
addJacksonConverterFactory()
Adds aJacksonConverterFactory
to theretrofitBuilder
.CallHttpApis.Builder
addScalarsConverterFactory()
Adds aScalarsConverterFactory
to theretrofitBuilder
.CallHttpApis.Builder
authenticator(okhttp3.Authenticator authenticator)
CallHttpApis.Builder
baseUrl(java.lang.String baseUrl)
Sets the base URL to theretrofitBuilder
.<C> C
build(java.lang.Class<? extends C> clientClass)
Finalizes the build and returns the client.
-
-
-
Method Detail
-
baseUrl
public CallHttpApis.Builder baseUrl(java.lang.String baseUrl)
Sets the base URL to theretrofitBuilder
.- Parameters:
baseUrl
- base URL of the API- Returns:
- the
CallHttpApis.Builder
- See Also:
Retrofit.Builder.baseUrl(String)
-
addConverterFactory
public CallHttpApis.Builder addConverterFactory(retrofit2.Converter.Factory converterFactory)
Adds the givenConverter.Factory
to theretrofitBuilder
.- Parameters:
converterFactory
- aConverter.Factory
to be added to theretrofitBuilder
- Returns:
- the
CallHttpApis.Builder
- See Also:
Retrofit.Builder.addConverterFactory(Converter.Factory)
-
addScalarsConverterFactory
public CallHttpApis.Builder addScalarsConverterFactory()
Adds aScalarsConverterFactory
to theretrofitBuilder
.- Returns:
- the
CallHttpApis.Builder
- See Also:
addConverterFactory(Converter.Factory)
,ScalarsConverterFactory
-
addJacksonConverterFactory
public CallHttpApis.Builder addJacksonConverterFactory()
Adds aJacksonConverterFactory
to theretrofitBuilder
.- Returns:
- the
CallHttpApis.Builder
- See Also:
addConverterFactory(Converter.Factory)
,JacksonConverterFactory
-
addInterceptor
public CallHttpApis.Builder addInterceptor(okhttp3.Interceptor interceptor)
Adds the givenInterceptor
to theokHttpClientBuilder
.- Parameters:
interceptor
- anInterceptor
to be added to theokHttpClientBuilder
- Returns:
- the
CallHttpApis.Builder
- See Also:
OkHttpClient.Builder.addInterceptor(Interceptor)
-
authenticator
public CallHttpApis.Builder authenticator(okhttp3.Authenticator authenticator)
-
build
public <C> C build(java.lang.Class<? extends C> clientClass)
Finalizes the build and returns the client.- Type Parameters:
C
- the type of the API client class- Parameters:
clientClass
- the API client class- Returns:
- an instance of clientClass to interact with the API
- See Also:
Retrofit.Builder.build()
,OkHttpClient.Builder.build()
,Retrofit.create(Class)
-
-