/** * Class Adapter Design Pattern example for COM1204 Summer 2003 - Tester/Driver. *
This test uses the OldProvider and then the EnhancedProvider, * which adapts the call to use an already ExistingService class. * * @author Bob Futrelle * @version 0.1, 4 July 2003 * */ public class AdapterDemo { public static void main(String[] args) { // Create a Client handing it an OldProvider. //Then call its getService() method. Provider oldProvider = new OldProvider(); Client client1 = new Client(oldProvider); System.out.println("Using the basic Provider without an Adapter:"); client1.getService(); // Then create one handing it an EnhancedProvider // and then call its getService() method. Provider useExisting = new EnhancedProvider(); Client client2 = new Client(useExisting); System.out.println("\nUsing an Adapter to access an existing service."); client2.getService(); } // main() } // class AdapterDemo // Output from the run above: /* */