Class RestClients

java.lang.Object
com.codename1.io.rest.RestClients

public final class RestClients extends Object
Runtime registry that wires @RestClient-annotated interfaces to the build-time-generated implementations. The generated cn1app.RestClientBootstrap calls register(Class, Factory) for every API interface in the project; user code reaches them via the static of(String baseUrl) factory that cn1:generate-openapi puts on each interface, and that factory in turn calls create(Class, String) here.
  • Method Details

    • register

      public static <T> void register(Class<T> apiType, RestClients.Factory<T> factory)
      Registers a factory for an @RestClient-annotated interface. Called from the generated cn1app.RestClientBootstrap so the REST plumbing is set up before the first <Api>.of(baseUrl) call.
    • create

      public static <T> T create(Class<T> apiType, String baseUrl)
      Returns a freshly-built client for the requested API. Called by the static of(String baseUrl) factory emitted on every generated @RestClient interface.