Understanding the concept behind Service provider framework like JDBC using the factory method
Consider something like the following: public interface MyService { void doSomething(); } public class MyServiceFactory { public static MyService getService() { try { (MyService) Class.forName(System.getProperty(“MyServiceImplemetation”)).newInstance(); } catch (Throwable t) { throw new Error(t); } } } With this code, your library doesn’t need to know about the implementations of the service. Users of your library … Read more