I am creating a wrapper for Retrofit. The interface is as follows:
public interface OkRetroInterface {
@GET
retrofit2.Call<OkRetroType> get(@Url String Url);
@POST
retrofit2.Call<OkRetroType> post(@Url String Url);
}
OkRetroType is just an implementation of the Type interface.
public class OkRetroType implements Type {
}
What I want to do is let the user enter the URL and class for the expected JSON response and return the processed response to the user on a successful call and handle the error otherwise. So, how should I determine the interface that the class accepts for the expected JSON, the URL of the API and returns the expected object.
The main thing I need to solve is to dynamically set the type of response I'm going to receive, i.e. configure OkRetroType at run time.
source
share