org.eclipse.uml2
Interface Package

All Superinterfaces:
Element, EModelElement, EObject, NamedElement, Namespace, Notifier, PackageableElement, ParameterableElement, TemplateableElement
All Known Subinterfaces:
Model, Profile

public interface Package
extends Namespace, PackageableElement

A representation of the model object 'Package'. A package is a namespace for its members, and may contain other packages. Only packageable elements can be owned members of a package. By virtue of being a namespace, a package can import either individual members of other packages, or all the members of other packages. In addition a package can be merged with other packages.

The following features are supported:

See Also:
UML2Package.getPackage()

Field Summary
static java.lang.String copyright
           
 
Fields inherited from interface org.eclipse.uml2.NamedElement
SEPARATOR
 
Method Summary
 void apply(Profile profile)
          Applies the current version of the specified profile to this package; if a different version is already applied, automatically migrates any associated stereotype values on a "best effort" basis (matching classifiers and structural features by name).
 Package createNestedPackage(java.lang.String name)
          Creates a package with the specified name as a nested package of this package.
 Class createOwnedClass(java.lang.String name, boolean isAbstract)
          Creates a(n) (abstract) class with the specified name as an owned member of this package.
 Enumeration createOwnedEnumeraton(java.lang.String name)
          Creates an enumeration with the specified name as an owned member of this package.
 PackageableElement createOwnedMember(EClass eClass)
          Creates a PackageableElement and appends it to the 'Owned Member' containment reference list
 PrimitiveType createOwnedPrimitiveType(java.lang.String name)
          Creates a primitive type with the specified name as an owned member of this package.
 PackageMerge createPackageExtension()
          Creates a PackageMerge and appends it to the 'Package Extension' containment reference list
 PackageMerge createPackageExtension(EClass eClass)
          Deprecated. Use #createPackageExtension() instead.
 PackageMerge createPackageMerge()
          Creates a PackageMerge and appends it to the 'Package Merge' containment reference list
 PackageMerge createPackageMerge(EClass eClass)
          Deprecated. Use #createPackageMerge() instead.
 java.util.Set getAllAppliedProfiles()
          Retrieves the set of all profiles that are applied to this package, including profiles applied to its nesting package(s).
 EList getAppliedProfiles()
          Returns the value of the 'Applied Profile' reference list.
 java.lang.String getAppliedVersion(Profile profile)
          Retrieves the version of the specified profile that is applied to this package or (one of) its nesting package(s).
 Package getNestedPackage(java.lang.String name)
          Retrieves the Package with the specified 'Name' from the 'Nested Package' reference list
 EList getNestedPackages()
          Returns the value of the 'Nested Package' reference list.
 Package getNestingPackage()
          Returns the value of the 'Nesting Package' reference.
 NamedElement getOwnedMember(java.lang.String name)
          Retrieves the PackageableElement with the specified 'Name' from the 'Owned Member' containment reference list
 EList getOwnedMembers()
          Returns the value of the 'Owned Member' containment reference list.
 Type getOwnedType(java.lang.String name)
          Retrieves the Type with the specified 'Name' from the 'Owned Type' reference list
 EList getOwnedTypes()
          Returns the value of the 'Owned Type' reference list.
 EList getPackageExtensions()
          Returns the value of the 'Package Extension' containment reference list.
 EList getPackageMerges()
          Returns the value of the 'Package Merge' containment reference list.
 boolean isApplied(Profile profile)
          Determines whether the specified profile is applied to this package.
 boolean makesVisible(NamedElement el)
           A query based on the following OCL expression: el.visibility->isEmpty() or el.visibility = #public
 void unapply(Profile profile)
          Unapplies the specified profile from this package.
 boolean validateElementsPublicOrPrivate(DiagnosticChain diagnostics, java.util.Map context)
           An invariant constraint based on the following OCL expression: self.ownedElements->forAll(e | e.visibility->notEmpty() implies e.visbility = #public or e.visibility = #private)
 java.util.Set visibleMembers()
           A query based on the following OCL expression: member->select( m | self.makesVisible(m))
 
Methods inherited from interface org.eclipse.uml2.Namespace
createElementImport, createElementImport, createOwnedRule, createOwnedRule, createPackageImport, createPackageImport, excludeCollisions, getElementImports, getImportedMember, getImportedMembers, getImportedPackages, getMember, getMembers, getNamesOfMember, getOwnedRule, getOwnedRules, getPackageImports, importedMember, importElement, importMembers, importPackage, membersAreDistinguishable, validateImportedMemberDerived, validateMembersAreDistinguishable
 
Methods inherited from interface org.eclipse.uml2.NamedElement
allNamespaces, createDependency, createNameExpression, createNameExpression, getClientDependencies, getClientDependency, getLabel, getLabel, getName, getNameExpression, getNamespace, getQualifiedName, getVisibility, isDistinguishableFrom, qualifiedName, separator, setName, setNameExpression, setVisibility, validateNoName, validateQualifiedName, validateVisibilityNeedsOwnership
 
Methods inherited from interface org.eclipse.uml2.TemplateableElement
createOwnedTemplateSignature, createOwnedTemplateSignature, createTemplateBinding, createTemplateBinding, getOwnedTemplateSignature, getTemplateBindings, parameterableElements, setOwnedTemplateSignature
 
Methods inherited from interface org.eclipse.uml2.Element
addKeyword, allOwnedElements, apply, createEAnnotation, createOwnedComment, createOwnedComment, destroy, getApplicableStereotype, getApplicableStereotypes, getAppliedStereotype, getAppliedStereotypes, getAppliedVersion, getKeywords, getModel, getNearestPackage, getOwnedComments, getOwnedElements, getOwner, getValue, hasKeyword, hasValue, isApplied, isRequired, mustBeOwned, removeKeyword, setValue, unapply, validateHasOwner, validateNotOwnSelf
 
Methods inherited from interface org.eclipse.emf.ecore.EModelElement
getEAnnotation, getEAnnotations
 
Methods inherited from interface org.eclipse.emf.ecore.EObject
eAllContents, eClass, eContainer, eContainingFeature, eContainmentFeature, eContents, eCrossReferences, eGet, eGet, eIsProxy, eIsSet, eResource, eSet, eUnset
 
Methods inherited from interface org.eclipse.emf.common.notify.Notifier
eAdapters, eDeliver, eNotify, eSetDeliver
 
Methods inherited from interface org.eclipse.uml2.PackageableElement
getPackageableElement_visibility, setPackageableElement_visibility
 
Methods inherited from interface org.eclipse.uml2.ParameterableElement
getOwningParameter, getTemplateParameter, setOwningParameter, setTemplateParameter
 

Field Detail

copyright

public static final java.lang.String copyright

See Also:
Constant Field Values
Method Detail

getNestedPackages

public EList getNestedPackages()
Returns the value of the 'Nested Package' reference list. The list contents are of type Package. It is bidirectional and its opposite is 'Nesting Package'.

If the meaning of the 'Nested Package' reference list isn't clear, there really should be more of a description here...

References the owned members that are Packages. Subsets Package::ownedMember.

Returns:
the value of the 'Nested Package' reference list.
See Also:
UML2Package.getPackage_NestedPackage(), getNestingPackage()

getNestedPackage

public Package getNestedPackage(java.lang.String name)
Retrieves the Package with the specified 'Name' from the 'Nested Package' reference list.

Parameters:
name - The 'Name' of the Package to retrieve.
Returns:
The Package with the specified 'Name', or null.
See Also:
getNestedPackages()

getNestingPackage

public Package getNestingPackage()
Returns the value of the 'Nesting Package' reference. It is bidirectional and its opposite is 'Nested Package'.

If the meaning of the 'Nesting Package' reference isn't clear, there really should be more of a description here...

Returns:
the value of the 'Nesting Package' reference.
See Also:
UML2Package.getPackage_NestingPackage(), getNestedPackages()

getOwnedTypes

public EList getOwnedTypes()
Returns the value of the 'Owned Type' reference list. The list contents are of type Type. It is bidirectional and its opposite is 'Package'.

If the meaning of the 'Owned Type' reference list isn't clear, there really should be more of a description here...

References the owned members that are Types. Subsets Package::ownedMember.

Returns:
the value of the 'Owned Type' reference list.
See Also:
UML2Package.getPackage_OwnedType(), Type.getPackage()

getOwnedType

public Type getOwnedType(java.lang.String name)
Retrieves the Type with the specified 'Name' from the 'Owned Type' reference list.

Parameters:
name - The 'Name' of the Type to retrieve.
Returns:
The Type with the specified 'Name', or null.
See Also:
getOwnedTypes()

getOwnedMembers

public EList getOwnedMembers()
Returns the value of the 'Owned Member' containment reference list. The list contents are of type PackageableElement.

If the meaning of the 'Owned Member' containment reference list isn't clear, there really should be more of a description here...

Specifies the members that are owned by this Package. Redefines Namespace::ownedMember.

Specified by:
getOwnedMembers in interface Namespace
Returns:
the value of the 'Owned Member' containment reference list.
See Also:
UML2Package.getPackage_OwnedMember()

getOwnedMember

public NamedElement getOwnedMember(java.lang.String name)
Retrieves the PackageableElement with the specified 'Name' from the 'Owned Member' containment reference list.

Specified by:
getOwnedMember in interface Namespace
Parameters:
name - The 'Name' of the PackageableElement to retrieve.
Returns:
The PackageableElement with the specified 'Name', or null.
See Also:
getOwnedMembers()

createOwnedMember

public PackageableElement createOwnedMember(EClass eClass)
Creates a PackageableElement and appends it to the 'Owned Member' containment reference list.

Parameters:
eClass - The Ecore class of the PackageableElement to create.
Returns:
The new PackageableElement.
See Also:
getOwnedMembers()

getPackageMerges

public EList getPackageMerges()
Returns the value of the 'Package Merge' containment reference list. The list contents are of type PackageMerge. It is bidirectional and its opposite is 'Merging Package'.

If the meaning of the 'Package Merge' containment reference list isn't clear, there really should be more of a description here...

Returns:
the value of the 'Package Merge' containment reference list.
See Also:
UML2Package.getPackage_PackageMerge(), PackageMerge.getMergingPackage()

createPackageMerge

public PackageMerge createPackageMerge(EClass eClass)
Deprecated. Use #createPackageMerge() instead.

Creates a PackageMerge and appends it to the 'Package Merge' containment reference list.

Parameters:
eClass - The Ecore class of the PackageMerge to create.
Returns:
The new PackageMerge.
See Also:
getPackageMerges()

createPackageMerge

public PackageMerge createPackageMerge()
Creates a PackageMerge and appends it to the 'Package Merge' containment reference list.

Returns:
The new PackageMerge.
See Also:
getPackageMerges()

getAppliedProfiles

public EList getAppliedProfiles()
Returns the value of the 'Applied Profile' reference list. The list contents are of type ProfileApplication.

If the meaning of the 'Applied Profile' reference list isn't clear, there really should be more of a description here...

Returns:
the value of the 'Applied Profile' reference list.
See Also:
UML2Package.getPackage_AppliedProfile()

getPackageExtensions

public EList getPackageExtensions()
Returns the value of the 'Package Extension' containment reference list. The list contents are of type PackageMerge.

If the meaning of the 'Package Extension' containment reference list isn't clear, there really should be more of a description here...

Returns:
the value of the 'Package Extension' containment reference list.
See Also:
UML2Package.getPackage_PackageExtension()

createPackageExtension

public PackageMerge createPackageExtension(EClass eClass)
Deprecated. Use #createPackageExtension() instead.

Creates a PackageMerge and appends it to the 'Package Extension' containment reference list.

Parameters:
eClass - The Ecore class of the PackageMerge to create.
Returns:
The new PackageMerge.
See Also:
getPackageExtensions()

createPackageExtension

public PackageMerge createPackageExtension()
Creates a PackageMerge and appends it to the 'Package Extension' containment reference list.

Returns:
The new PackageMerge.
See Also:
getPackageExtensions()

validateElementsPublicOrPrivate

public boolean validateElementsPublicOrPrivate(DiagnosticChain diagnostics,
                                               java.util.Map context)
An invariant constraint based on the following OCL expression: self.ownedElements->forAll(e | e.visibility->notEmpty() implies e.visbility = #public or e.visibility = #private)


visibleMembers

public java.util.Set visibleMembers()
A query based on the following OCL expression: member->select( m | self.makesVisible(m))


makesVisible

public boolean makesVisible(NamedElement el)
A query based on the following OCL expression: el.visibility->isEmpty() or el.visibility = #public


isApplied

public boolean isApplied(Profile profile)
Determines whether the specified profile is applied to this package.

Parameters:
profile - The profile to test for application.
Returns:
true if the profile is applied to this package; false otherwise.

getAllAppliedProfiles

public java.util.Set getAllAppliedProfiles()
Retrieves the set of all profiles that are applied to this package, including profiles applied to its nesting package(s).

Returns:
The profiles applied to the package.

apply

public void apply(Profile profile)
Applies the current version of the specified profile to this package; if a different version is already applied, automatically migrates any associated stereotype values on a "best effort" basis (matching classifiers and structural features by name).

Parameters:
profile - The profile to be applied.
Throws:
java.lang.IllegalArgumentException - If the profile is not defined or its current version is already applied to this package or (one of) its nesting package(s).

unapply

public void unapply(Profile profile)
Unapplies the specified profile from this package.

Parameters:
profile - The profile to be unapplied.
Throws:
java.lang.IllegalArgumentException - If the profile is not applied to this package.

getAppliedVersion

public java.lang.String getAppliedVersion(Profile profile)
Retrieves the version of the specified profile that is applied to this package or (one of) its nesting package(s).

Parameters:
profile - The profile whose applied version to retrieve.
Returns:
The version of the profile, or null if not applied.

createNestedPackage

public Package createNestedPackage(java.lang.String name)
Creates a package with the specified name as a nested package of this package.

Parameters:
name - The name for the nested package.
Returns:
The new package.
Throws:
java.lang.IllegalArgumentException - If the name is empty.

createOwnedClass

public Class createOwnedClass(java.lang.String name,
                              boolean isAbstract)
Creates a(n) (abstract) class with the specified name as an owned member of this package.

Parameters:
name - The name for the owned class.
isAbstract - Whether the owned class should be abstract.
Returns:
The new class.
Throws:
java.lang.IllegalArgumentException - If the name is empty.

createOwnedEnumeraton

public Enumeration createOwnedEnumeraton(java.lang.String name)
Creates an enumeration with the specified name as an owned member of this package.

Parameters:
name - The name for the owned enumeration.
Returns:
The new enumeration.
Throws:
java.lang.IllegalArgumentException - If the name is empty.

createOwnedPrimitiveType

public PrimitiveType createOwnedPrimitiveType(java.lang.String name)
Creates a primitive type with the specified name as an owned member of this package.

Parameters:
name - The name for the owned primitive type.
Returns:
The new primitive type.
Throws:
java.lang.IllegalArgumentException - If the name is empty.

Copyright 2003, 2005 IBM Corporation and others.
All Rights Reserved.