Previous | UML Classes | Table of Contents | UML Packages | Next |
A package import is a relationship that allows the use of unqualified names to refer to package members from other namespaces.
•
DirectedRelationship (from Kernel ) on page 62
A package import is defined as a directed relationship that identifies a package whose members are to be imported by a namespace.
• visibility: VisibilityKind Specifies the visibility of the imported PackageableElement s within the importing Namespace , i.e., whether imported elements will in turn be visible to other packages that use that importingPackage as an importedPackage. If the PackageImport is public, the imported elements will be visible outside the package, while if it is private they will not. By default, the value of visibility is public.
• importedPackage: Package [1] Specifies the Package whose members are imported into a Namespace . Subsets DirectedRelationship ::target
• importingNamespace : Namespace [1] Specifies the Namespace that imports the members from a Package. Subsets DirectedRelationship ::source and Element::owner
[1] The visibility of a PackageImport is either public or private.
self.visibility = #public or self.visibility = #private
A package import is a relationship between an importing namespace and a package, indicating that the importing namespace adds
the names of the members of the package to its own namespace. Conceptually, a package import is equivalent to having an element
import to each individual member of the imported namespace, unless there is already a separately-defined element import.
A package import is shown using a dashed arrow with an open arrowhead from the importing namespace to the imported package.
A keyword is shown near the dashed arrow to identify which kind of package import is intended. The predefined keywords are
«import» for a public package import, and «access» for a private package import.
As an alternative to the dashed arrow, it is possible to show an element import by having a text that uniquely identifies
the imported element within curly brackets either below or after the name of the namespace. The textual syntax is then:
‘{import ’ <qualified-name> ‘}’ | ‘{access ’ <qualified-name> ‘}’
In Figure 7.64, a number of package imports are shown. The elements in Types are imported to ShoppingCart, and then further
imported to WebShop. However, the elements of Auxiliary are only accessed from ShoppingCart, and cannot be referenced using
unqualified names from WebShop.