Class 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> T build​(java.lang.Class<T> service)
      Uses this builder to create a Retrofit client implementation.
      RatpackRetrofit.Builder configure​(ratpack.func.Action<? super Retrofit.Builder> builderAction)
      Configure the underlying Retrofit.Builder instance.
      RatpackRetrofit.Builder httpClient​(ratpack.func.Factory<? extends ratpack.core.http.client.HttpClient> clientFactory)
      Configures a Factory that supplies the underlying HttpClient to back client interfaces generated from the return of retrofit()
      Retrofit retrofit()
      Creates the underlying Retrofit instance and configures it to interface with HttpClient and Promise.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • httpClient

        public RatpackRetrofit.Builder httpClient​(ratpack.func.Factory<? extends ratpack.core.http.client.HttpClient> clientFactory)
        Configures a Factory that supplies the underlying HttpClient to back client interfaces generated from the return of retrofit()

        By default, the following locations are searched in order, with the first HttpClient found used to back the client interfaces.

        • Current Execution
        • Context in the current Execution

        If no HttpClient is found, a NotInRegistryException is thrown.

        Parameters:
        clientFactory - a factory that generates a HttpClient to be used
        Returns:
        this
        Since:
        1.6
      • retrofit

        public Retrofit retrofit()
        Creates the underlying Retrofit instance and configures it to interface with HttpClient and Promise.

        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.