Previous | UML Classes | Table of Contents | UML Packages | Next |
VisibilityKind is an enumeration type that defines literals to determine the visibility of elements in a model.
None
VisibilityKind is an enumeration of the following literal values:
• public
• private
• protected
• package
[1] The query bestVisibility() examines a set of VisibilityKind s that includes only public and private, and returns public
as the preferred visibility. VisibilityKind ::bestVisibility(vis: Set(VisibilityKind )) : VisibilityKind ; pre: not vis->includes(#protected)
and not vis->includes(#package)
bestVisibility = if vis->includes(#public) then #public else #private endif
Issue 4448 -Visibility constrains the actionsof methods of the class. Creation and destruction of links should be allowed
by methods that have access to at least one end of the association.
VisibilityKind is intended for use in the specification of visibility in conjunction with, for example, the Imports, Generalizations,
and, Packages, and Classes packages. Detailed semantics are specified with those mechanisms. If the Visibility package is
used without those packages, these literals will have different meanings, or no meanings.
•
A public element is visible to all elements that can access the contents of the namespace that owns it.
•
A private element is only visible inside the namespace that owns it.
•
A protected element is visible to elements that have a generalization relationship to the namespace that owns it.
•
A package element is owned by a namespace that is not a package, and is visible to elements that are in the same package as
its owning namespace. Only named elements that are not owned by packages can be marked as having package visibility. Any element
marked as having package visibility is visible to all elements within the nearest enclosing package (given that other owning
elements have proper visibility). Outside the nearest enclosing package, an element marked as having package visibility is
not visible.
In circumstances where a named element ends up with multiple visibilities (for example, by being imported multiple times)
public visibility overrides private visibility. If an element is imported twice into the same namespace, once using a public
import and once using a private import, it will be public.
The following visual presentation options are available for representing VisibilityKind enumeration literal values:
•
‘+’ public
•
‘-’ private
•
‘#’ protected
•
‘~’ package