Class Package
A package can have one or more profile applications to indicate which profiles have been applied. Because a profile is a package, it is possible to apply a profile not only to packages, but also to profiles. Package specializes TemplateableElement and PackageableElement specializes ParameterableElement to specify that a package can be used as a template and a PackageableElement as a template parameter. A package is used to group elements, and provides a namespace for the grouped elements. <p>From package UML::Packages.</p>
[XmlNamespace("http://www.eclipse.org/uml2/5.0.0/UML")]
[XmlNamespacePrefix("uml")]
[ModelRepresentationClass("http://www.eclipse.org/uml2/5.0.0/UML#//Package")]
public class Package : Namespace, IPackage, ITemplateableElement, IPackageableElement, IParameterableElement, INamespace, INamedElement, IElement, IEModelElement, IModelElement, INotifyPropertyChanged, INotifyPropertyChanging
- Inheritance
-
Package
- Implements
- Derived
- Inherited Members
Constructors
Package()
Creates a new instance
public Package()
Properties
Children
Gets the child model elements of this model element
public override IEnumerableExpression<IModelElement> Children { get; }
Property Value
ClassInstance
Gets the Class model for this type
public static IClass ClassInstance { get; }
Property Value
NestedPackage
References the packaged elements that are Packages. <p>From package UML::Packages.</p>
[Browsable(false)]
[XmlElementName("nestedPackage")]
[XmlAttribute(false)]
[Containment]
[XmlOpposite("nestingPackage")]
public IOrderedSetExpression<IPackage> NestedPackage { get; }
Property Value
NestingPackage
References the Package that owns this Package. <p>From package UML::Packages.</p>
[Browsable(false)]
[XmlElementName("nestingPackage")]
[XmlAttribute(true)]
[XmlOpposite("nestedPackage")]
public IPackage NestingPackage { get; set; }
Property Value
OwnedStereotype
References the Stereotypes that are owned by the Package. <p>From package UML::Packages.</p>
[Browsable(false)]
[XmlElementName("ownedStereotype")]
[XmlAttribute(false)]
[Containment]
public IOrderedSetExpression<IStereotype> OwnedStereotype { get; }
Property Value
OwnedTemplateSignature
The optional TemplateSignature specifying the formal TemplateParameters for this TemplateableElement. If a TemplateableElement has a TemplateSignature, then it is a template. <p>From package UML::CommonStructure.</p>
[Browsable(false)]
[XmlElementName("ownedTemplateSignature")]
[XmlAttribute(false)]
[Containment]
[XmlOpposite("template")]
public ITemplateSignature OwnedTemplateSignature { get; set; }
Property Value
OwnedType
References the packaged elements that are Types. <p>From package UML::Packages.</p>
[Browsable(false)]
[XmlElementName("ownedType")]
[XmlAttribute(false)]
[Containment]
[XmlOpposite("package")]
public IOrderedSetExpression<IType> OwnedType { get; }
Property Value
OwningTemplateParameter
The formal TemplateParameter that owns this ParameterableElement. <p>From package UML::CommonStructure.</p>
[XmlElementName("owningTemplateParameter")]
[XmlAttribute(true)]
[XmlOpposite("ownedParameteredElement")]
public ITemplateParameter OwningTemplateParameter { get; set; }
Property Value
PackageMerge
References the PackageMerges that are owned by this Package. <p>From package UML::Packages.</p>
[Browsable(false)]
[XmlElementName("packageMerge")]
[XmlAttribute(false)]
[Containment]
[XmlOpposite("receivingPackage")]
public IOrderedSetExpression<IPackageMerge> PackageMerge { get; }
Property Value
ProfileApplication
References the ProfileApplications that indicate which profiles have been applied to the Package. <p>From package UML::Packages.</p>
[Browsable(false)]
[XmlElementName("profileApplication")]
[XmlAttribute(false)]
[Containment]
[XmlOpposite("applyingPackage")]
public IOrderedSetExpression<IProfileApplication> ProfileApplication { get; }
Property Value
ReferencedElements
Gets the referenced model elements of this model element
public override IEnumerableExpression<IModelElement> ReferencedElements { get; }
Property Value
TemplateBinding
The optional TemplateBindings from this TemplateableElement to one or more templates. <p>From package UML::CommonStructure.</p>
[Browsable(false)]
[XmlElementName("templateBinding")]
[XmlAttribute(false)]
[Containment]
[XmlOpposite("boundElement")]
public IOrderedSetExpression<ITemplateBinding> TemplateBinding { get; }
Property Value
TemplateParameter
The TemplateParameter that exposes this ParameterableElement as a formal parameter. <p>From package UML::CommonStructure.</p>
[XmlElementName("templateParameter")]
[XmlAttribute(true)]
[XmlOpposite("parameteredElement")]
public ITemplateParameter TemplateParameter { get; set; }
Property Value
URI
Provides an identifier for the package that can be used for many purposes. A URI is the universally unique identification of the package following the IETF URI specification, RFC 2396 http://www.ietf.org/rfc/rfc2396.txt and it must comply with those syntax rules. <p>From package UML::Packages.</p>
[XmlAttribute(true)]
public string URI { get; set; }
Property Value
Methods
AllApplicableStereotypes()
The query allApplicableStereotypes() returns all the directly or indirectly owned stereotypes, including stereotypes contained in sub-profiles. result = (let ownedPackages : Bag(Package) = ownedMember->select(oclIsKindOf(Package))->collect(oclAsType(Package)) in ownedStereotype->union(ownedPackages.allApplicableStereotypes())->flatten()->asSet() ) <p>From package UML::Packages.</p>
public ISetExpression<IStereotype> AllApplicableStereotypes()
Returns
ApplyProfile(IProfile)
Applies the current definition of the specified profile to this package and automatically applies required stereotypes in the profile to elements within this package's namespace hieararchy. If a different definition is already applied, automatically migrates any associated stereotype values on a "best effort" basis (matching classifiers and structural features by name).
public ISetExpression<IEObject> ApplyProfile(IProfile profile)
Parameters
profile
IProfileThe profile to apply.
Returns
ApplyProfiles(IEnumerable<IProfile>)
Applies the current definitions of the specified profiles to this package and automatically applies required stereotypes in the profiles to elements within this package's namespace hieararchy. If different definitions are already applied, automatically migrates any associated stereotype values on a "best effort" basis (matching classifiers and structural features by name).
public ISetExpression<IEObject> ApplyProfiles(IEnumerable<IProfile> profiles)
Parameters
profiles
IEnumerable<IProfile>The profiles to apply.
Returns
ContainingProfile()
The query containingProfile() returns the closest profile directly or indirectly containing this package (or this package itself, if it is a profile). result = (if self.oclIsKindOf(Profile) then self.oclAsType(Profile) else self.namespace.oclAsType(Package).containingProfile() endif) <p>From package UML::Packages.</p>
public IProfile ContainingProfile()
Returns
CreateOwnedClass(string, bool)
Creates a(n) (abstract) class with the specified name as an owned type of this package.
public IClass CreateOwnedClass(string name, bool isAbstract)
Parameters
name
stringThe name for the new class, or null.
isAbstract
boolWhether the new class should be abstract.
Returns
CreateOwnedEnumeration(string)
Creates a enumeration with the specified name as an owned type of this package.
public IEnumeration CreateOwnedEnumeration(string name)
Parameters
name
stringThe name for the new enumeration, or null.
Returns
CreateOwnedInterface(string)
Creates an interface with the specified name as an owned type of this package.
public IInterface CreateOwnedInterface(string name)
Parameters
name
stringThe name for the new interface, or null.
Returns
CreateOwnedPrimitiveType(string)
Creates a primitive type with the specified name as an owned type of this package.
public IPrimitiveType CreateOwnedPrimitiveType(string name)
Parameters
name
stringThe name for the new primitive type, or null.
Returns
CreateOwnedStereotype(string, bool)
Creates a(n) (abstract) stereotype with the specified name as an owned stereotype of this profile.
public IStereotype CreateOwnedStereotype(string name, bool isAbstract)
Parameters
name
stringThe name for the new stereotype, or null.
isAbstract
boolWhether the new stereotype should be abstract.
Returns
Elements_public_or_private(object, object)
If an element that is owned by a package has visibility, it is public or private. packagedElement->forAll(e | e.visibility<> null implies e.visibility = VisibilityKind::public or e.visibility = VisibilityKind::private)
public bool Elements_public_or_private(object diagnostics, object context)
Parameters
diagnostics
objectThe chain of diagnostics to which problems are to be appended.
context
objectThe cache of context-specific information.
Returns
GetAllAppliedProfiles()
Retrieves all the profiles that are applied to this package, including profiles applied to its nesting package(s).
public ISetExpression<IProfile> GetAllAppliedProfiles()
Returns
GetAllProfileApplications()
Retrieves all the profile applications for this package, including profile applications for its nesting package(s).
public ISetExpression<IProfileApplication> GetAllProfileApplications()
Returns
GetAppliedProfile(string)
Retrieves the profile with the specified qualified name that is applied to this package, or null if no such profile is applied.
public IProfile GetAppliedProfile(string qualifiedName)
Parameters
qualifiedName
stringThe qualified name of the applied profile to retrieve.
Returns
GetAppliedProfile(string, bool)
Retrieves the profile with the specified qualified name that is applied to this package or any of its nesting packages (if indicated), or null if no such profile is applied.
public IProfile GetAppliedProfile(string qualifiedName, bool recurse)
Parameters
qualifiedName
stringThe qualified name of the applied profile to retrieve.
recurse
boolWhether to look in nesting packages.
Returns
GetAppliedProfiles()
Retrieves the profiles that are applied to this package.
public ISetExpression<IProfile> GetAppliedProfiles()
Returns
GetAttributeValue(string, int)
Resolves the given attribute name
protected override object GetAttributeValue(string attribute, int index)
Parameters
Returns
- object
The attribute value or null if it could not be found
GetClass()
Gets the Class for this model element
public override IClass GetClass()
Returns
GetCollectionForFeature(string)
Gets the Model element collection for the given feature
protected override IList GetCollectionForFeature(string feature)
Parameters
feature
stringThe requested feature
Returns
- IList
A non-generic list of elements
GetCompositionName(object)
Gets the property name for the given container
protected override string GetCompositionName(object container)
Parameters
container
objectThe container object
Returns
- string
The name of the respective container reference
GetExpressionForAttribute(string)
Gets the property expression for the given attribute
protected override INotifyExpression<object> GetExpressionForAttribute(string attribute)
Parameters
attribute
stringThe requested attribute in upper case
Returns
- INotifyExpression<object>
An incremental property expression
GetExpressionForReference(string)
Gets the property expression for the given reference
protected override INotifyExpression<IModelElement> GetExpressionForReference(string reference)
Parameters
reference
stringThe requested reference in upper case
Returns
- INotifyExpression<IModelElement>
An incremental property expression
GetModelElementForReference(string, int)
Resolves the given URI to a child model element
protected override IModelElement GetModelElementForReference(string reference, int index)
Parameters
Returns
- IModelElement
The model element or null if it could not be found
GetNestedPackages()
Derivation for Package::/nestedPackage result = (packagedElement->select(oclIsKindOf(Package))->collect(oclAsType(Package))->asSet()) <p>From package UML::Packages.</p>
public ISetExpression<IPackage> GetNestedPackages()
Returns
GetOwnedStereotypes()
Derivation for Package::/ownedStereotype result = (packagedElement->select(oclIsKindOf(Stereotype))->collect(oclAsType(Stereotype))->asSet()) <p>From package UML::Packages.</p>
public ISetExpression<IStereotype> GetOwnedStereotypes()
Returns
GetOwnedTypes()
Derivation for Package::/ownedType result = (packagedElement->select(oclIsKindOf(Type))->collect(oclAsType(Type))->asSet()) <p>From package UML::Packages.</p>
public ISetExpression<IType> GetOwnedTypes()
Returns
GetProfileApplication(IProfile)
Retrieves the application of the specified profile to this package, or null if no such profile is applied.
public IProfileApplication GetProfileApplication(IProfile profile)
Parameters
profile
IProfileThe profile whose application to retrieve.
Returns
GetProfileApplication(IProfile, bool)
Retrieves the application of the specified profile to this package or any of its nesting packages (if indicated), or null if no such profile is applied.
public IProfileApplication GetProfileApplication(IProfile profile, bool recurse)
Parameters
profile
IProfileThe profile whose application to retrieve.
recurse
boolWhether to look in nesting packages.
Returns
GetRelativePathForNonIdentifiedChild(IModelElement)
Gets the relative URI fragment for the given child model element
protected override string GetRelativePathForNonIdentifiedChild(IModelElement element)
Parameters
element
IModelElementThe element that should be looked for
Returns
- string
A fragment of the relative URI
IsCompatibleWith(IParameterableElement)
The query isCompatibleWith() determines if this ParameterableElement is compatible with the specified ParameterableElement. By default, this ParameterableElement is compatible with another ParameterableElement p if the kind of this ParameterableElement is the same as or a subtype of the kind of p. Subclasses of ParameterableElement should override this operation to specify different compatibility constraints. result = (self.oclIsKindOf(p.oclType())) <p>From package UML::CommonStructure.</p>
public bool IsCompatibleWith(IParameterableElement p)
Parameters
Returns
IsModelLibrary()
Determines whether this package is a model library.
public bool IsModelLibrary()
Returns
IsProfileApplied(IProfile)
Determines whether the specified profile is applied to this package.
public bool IsProfileApplied(IProfile profile)
Parameters
profile
IProfileThe profile in question.
Returns
IsTemplate()
The query isTemplate() returns whether this TemplateableElement is actually a template. result = (ownedTemplateSignature <> null) <p>From package UML::CommonStructure.</p>
public bool IsTemplate()
Returns
IsTemplateParameter()
The query isTemplateParameter() determines if this ParameterableElement is exposed as a formal TemplateParameter. result = (templateParameter->notEmpty()) <p>From package UML::CommonStructure.</p>
public bool IsTemplateParameter()
Returns
MakesVisible(INamedElement)
The query makesVisible() defines whether a Package makes an element visible outside itself. Elements with no visibility and elements with public visibility are made visible. member->includes(el) result = (ownedMember->includes(el) or (elementImport->select(ei|ei.importedElement = VisibilityKind::public)->collect(importedElement.oclAsType(NamedElement))->includes(el)) or (packageImport->select(visibility = VisibilityKind::public)->collect(importedPackage.member->includes(el))->notEmpty())) <p>From package UML::Packages.</p>
public bool MakesVisible(INamedElement el)
Parameters
Returns
Namespace_needs_visibility(object, object)
A PackageableElement owned by a Namespace must have a visibility. visibility = null implies namespace = null
public bool Namespace_needs_visibility(object diagnostics, object context)
Parameters
diagnostics
objectThe chain of diagnostics to which problems are to be appended.
context
objectThe cache of context-specific information.
Returns
OnParentChanged(IModelElement, IModelElement)
Gets called when the parent model element of the current model element changes
protected override void OnParentChanged(IModelElement newParent, IModelElement oldParent)
Parameters
newParent
IModelElementThe new parent model element
oldParent
IModelElementThe old parent model element
OnParentChanging(IModelElement, IModelElement)
Gets called when the parent model element of the current model element is about to change
protected override void OnParentChanging(IModelElement newParent, IModelElement oldParent)
Parameters
newParent
IModelElementThe new parent model element
oldParent
IModelElementThe old parent model element
ParameterableElements()
The query parameterableElements() returns the set of ParameterableElements that may be used as the parameteredElements for a TemplateParameter of this TemplateableElement. By default, this set includes all the ownedElements. Subclasses may override this operation if they choose to restrict the set of ParameterableElements. result = (self.allOwnedElements()->select(oclIsKindOf(ParameterableElement)).oclAsType(ParameterableElement)->asSet()) <p>From package UML::CommonStructure.</p>
public ISetExpression<IParameterableElement> ParameterableElements()
Returns
SetFeature(string, object)
Sets a value to the given feature
protected override void SetFeature(string feature, object value)
Parameters
UnapplyProfile(IProfile)
Unapplies the specified profile from this package and automatically unapplies stereotypes in the profile from elements within this package's namespace hieararchy.
public ISetExpression<IEObject> UnapplyProfile(IProfile profile)
Parameters
profile
IProfileThe profile to unapply.
Returns
VisibleMembers()
The query visibleMembers() defines which members of a Package can be accessed outside it. result = (member->select( m | m.oclIsKindOf(PackageableElement) and self.makesVisible(m))->collect(oclAsType(PackageableElement))->asSet()) <p>From package UML::Packages.</p>
public ISetExpression<IPackageableElement> VisibleMembers()