pluggable interface : Java Glossary
home P words local find no local find frame, full screen Google search web for topic jump to footer translate with Babelfish 2008-05-13 by Roedy Green ©1996-2008 Canadian Mind Products
Go to : punctuation 0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z (all)
pluggable interface
Java’s interfaces and dynamic class loading make it easy to create pluggable interfaces such as LAF, JCE and JDBC. Many vendors can supply different code to implement the same interface that all behaves the same way, and easily plugs into a framework library without requiring any recompilation or linking. One of the clues you are using a pluggable interface is the lack of public constructors. All objects must be created via factory methods. The other clue is nearly all methods return interfaces rather than concrete classes.

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).


CMP_homejump to top
CMP logo
feedback Please email your feedback for publication, errors, omissions, broken/redirected link reports
and suggestions to improve this page to Roedy Green : feedback email
made with CSS
HTML Checked!
ICRA ratings logo
mindprod.com IP:[65.110.21.43]
Your face IP:[38.103.63.18] The information on this page is for non-military use only.
You are visitor number 11. Military use includes use by defence contractors.
You can get a fresh copy of this page from: or possibly from your local J: drive (Java virtual drive/Mindprod website mirror)
http://mindprod.com/jgloss/pluggableinterface.html J:\mindprod\jgloss\pluggableinterface.html