August 2001
Intermediate to advanced
480 pages
9h 14m
English
Recall that library bundles export utility classes but do not register services of their own. Selectively exporting some of the packages inside a library bundle makes it possible for callers to benefit from the changes immediately after an update. To accomplish this, you can design the library in an interface-provider fashion. For example, consider the following bundle:
META-INF/MANIFEST.MF com/acme/util/Sort.class com/acme/util/impl/QuickSort.class com/acme/util/impl/BubbleSort.class com/acme/util/impl/MergeSort.class
You may then declare
Export-Package: com.acme.util
in the manifest to export only the com.acme.util package containing the class Sort. A caller can pick an algorithm for sorting by writing code ...
Read now
Unlock full access