I am working on an API that should provide easy access to a number of resources based on a remote web service.
Some of these remote resources require special parameters for transmission before communication. For example, for one of them it is required to transfer a key pair of the developer, another - a key pair and a unique identifier. The third does not require these parameters at all. Now I work with three services, but their number can be increased.
For each web service, I have a corresponding implementation of my API. The problem is that I don’t know how to imagine the ability of my API to transmit an unknown number of rows with unknown values.
Some of my suggestions are:
1.
ServiceFactory.createService (ServiceEnum type, Properties keys);
2.
ServiceFactory.createService (ServiceEnum type, ServiceParams params);
ServiceParams - -. :
public class ServiceHelper {
public static ServiceParams createFirstServiceParams (String secretKey, String publicKey);
public static ServiceParams createSecondServiceParams (String secretKey, String publicKey, String uid);
public static ServiceParams createThirdServiceParams ();
}
: .
: , . .
3.
ServiceFactory.createService (ServiceEnum type, String ... params);
: . (, ServiceParams).
: . , , .
4-6:
, factory, (, init()).
: , .
: , .
? ? .