A package can add external model elements by reference. If the visibility of a given element is public, the package performs an import; if the visibility is private, the package performs an access. Both import and access are shown as stereotyped dependencies, with the dependent package receiving the import or access. Figure 5-4 shows examples of both.
Note that if a package imports an element with the same name as an element contained within the package, the import must have an associated alias. Figure 5-5 shows an example of an import with an alias.
The WebServer package refers to the Book class within the Catalog package as CatalogBook going forward. (To avoid confusion, it's probably a good idea to rename one or the other Book class rather than relying on an alias.)
Import and access work the same ways on the package level. Figure 5-6 shows an example of a package import.
As a result of this import, the WebServer package can treat the Book and Author classes as if they belonged to it and not to the Catalog package.
A special case of a package import involves the ‚ «modelLibrary ‚ » stereotype. This stereotype signifies that the client package is using the source package as a library of shared model elements. For example, you might have a package of datatypes (see the section "Other Stereotypes on Classes" in Chapter 1) that you want to share among various packages.