1. Domino REST
  2. Rest clients
  3. Interface inheritance

Interface inheritance

A request factory interface can extend from other interfaces that does or does not have the request factory annotation. this means that we can generate a single request factory for multiple jax-rs interfaces, or we can generate a request factory for jax-rs interfaces when we dont have access to the source code to add the @RequestFactory annotation. each inherited interface can have its own @Path annotation. Example :

			@RequestFactory
public interface MoviesService {

    @Path("library/movies/:movieName")
    @GET
    Movie getMovieByName(@PathParam("movieName") String movieName);

    @Path("library/movies")
    @GET
    List<Movie> listMovies();

    @Path("library/movies/:name")
    @PUT
    @SuccessCodes({200})
    void updateMovie(@beanParam @RequestBody Movie movie);
}

		
			MoviesServiceFactory.INSTANCE
    .getMovieByName("hulk")
    .onSuccess(movie ->{})
    .send();

		
			@Path("second-root-path")
public interface SecondService {
    @Path("second-path")
    SomeResponse secondRequest();
}

		

This will generate a factory for all service methods from all three services, where FirstService and SecondService could be coming from an external dependency.

We are a group of passionate people who love what we do

Donate & Support Us