Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » AssociationClass directions
AssociationClass directions [message #628374] Mon, 19 April 2010 16:53 Go to next message
Lisa  is currently offline Lisa Friend
Messages: 6
Registered: April 2010
Junior Member
Hi everyone,
I've creater an AssociationClass using:

UMLFactory.eINSTANCE.createAssociationClass();

than I created two owned members as follows:

Property ownedEnd1 = associationClass.createOwnedEnd(null, class1_);
ownedEnd1.setLower(end1LowerBound);
ownedEnd1.setUpper(end1UpperBound);
ownedEnd1.setAggregation(end1AggregationKind);
ownedEnd1.setIsNavigable(true);
Property ownedEnd2 = associationClass.createOwnedEnd(null, class2_);
ownedEnd2.setLower(end2LowerBound);
ownedEnd2.setUpper(end2UpperBound);
ownedEnd2.setAggregation(end2AggregationKind);
ownedEnd2.setIsNavigable(true);

and both class1_ and class2_ are instance of org.eclipse.uml2.uml.Class

my question is how do I set the direction of the association that will be created between class1_ and class2

thanks,
Lisa
Re: AssociationClass directions [message #628404 is a reply to message #628374] Mon, 26 April 2010 14:00 Go to previous message
Christian Damus is currently offline Christian DamusFriend
Messages: 1270
Registered: July 2009
Location: Canada
Senior Member

Hi, Lisa,

As with simple Associations, the "directionality" is implied by which
ends of the association-class are navigable. Your code snippet sets
both ends navigable. Let one of them not be navigable. e.g., if
ownedEnd1 is not navigable, then the "direction" is from class1_ to class2_.

Also as with associations, an end of an AssociationClass can be owned by
one of the classifiers that it associates (e.g., class1_ or class2_),
rather than the association-class itself. Such an end is implicitly
navigable.

HTH,

Christian


On 19/04/10 12:53 PM, Lisa wrote:
> Hi everyone,
> I've creater an AssociationClass using:
>
> UMLFactory.eINSTANCE.createAssociationClass();
>
> than I created two owned members as follows:
>
> Property ownedEnd1 = associationClass.createOwnedEnd(null, class1_);
> ownedEnd1.setLower(end1LowerBound);
> ownedEnd1.setUpper(end1UpperBound);
> ownedEnd1.setAggregation(end1AggregationKind);
> ownedEnd1.setIsNavigable(true);
> Property ownedEnd2 = associationClass.createOwnedEnd(null, class2_);
> ownedEnd2.setLower(end2LowerBound);
> ownedEnd2.setUpper(end2UpperBound);
> ownedEnd2.setAggregation(end2AggregationKind);
> ownedEnd2.setIsNavigable(true);
>
> and both class1_ and class2_ are instance of org.eclipse.uml2.uml.Class
>
> my question is how do I set the direction of the association that will
> be created between class1_ and class2
>
> thanks,
> Lisa
Previous Topic:setNamespace / setOwner ?
Next Topic:Ecore 2 Uml conversion question
Goto Forum:
  


Current Time: Tue Apr 16 16:31:05 GMT 2024

Powered by FUDForum. Page generated in 1.08781 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top