Overview

Packages enable you to group reusable classes (implemented in one or more schemas) as an exported package and make them available to multiple unrelated schemas as an imported package.

Packages allow one schema (the importing schema) to import and make use of classes from another schema (the exporting schema). The importing and exporting schemas do not have to be related and they can exist in completely independent schema branches.

In this chapter, the term package refers to the mechanism by which reusable classes are exposed from an exporting schema or reused in an importing schema.

The exporting schema defines the classes that it exports in packages. A single schema can export multiple packages. You can include only classes with public access in a package. When you export a class, you can select the properties, methods, and constants that are made available to importing schemas.

The import name of a package, which is defined at the time it is imported, has the exported package name by default. An imported package does not have to have the same name as the exported package that it imports. However, you cannot change package definitions and export characteristics at import time. Imported classes implicitly inherit from the nearest RootSchema subschema copy class of the importing schema. You cannot subclass or re-export imported classes.

When an imported class is unambiguously identified (that is, its name does not conflict with a class already defined in the branch of the importing schema or with another imported class), you can access that class by name. When the name of an imported class conflicts with another class, access the class by prefixing the class name with the name of the imported package. When an imported class has the same name as a local class, notifications are registered for the local class.

For details about the :: operator that allows you to qualify imported class names, see "Accessing Meta Data", in Chapter 1.