To create a pluggable interface you define a suite of interfaces that a vendor or other third party must implement with real classes. He bundles his implementation code into a jar. Typically there will be a special registration class in the jar that gives the names of the class to use to implement any given interface and perhaps some factory classes to create various types of standard object. The registration class might customise the choices based on platform or user specifications.
To use the interface, the user specifies the vendor name whose implementation he wants. From them on he uses factory methods that look up the correct constructors, and via dynamic loading (Class. forName) or reflection call the vendor-specific methods. These methods return objects that the user then manipulates via their standard interface names, not their class names, though in theory you might use abstract class names too. The user is usually never aware of the vendor’s class names, (unless of course he cheats and peeks with Class. toString).
This page is posted
Optional Replicator mirror
|no blog for this page||Canadian
Your face IP:[184.108.40.206]
You are visitor number|