how to diagram a class which contains the definition of another class?

17 views
Skip to first unread message

netskink

unread,
Aug 4, 2011, 11:52:01 AM8/4/11
to UML Forum
ie. how to draw this?

public class foo {
public static class goo {
public static final int VAL=0;
}
}

I can draw a class for foo and goo. Maybe the question is what kind
of link would be drawn between foo and goo? A Containment link?

John

RJB

unread,
Aug 4, 2011, 2:50:25 PM8/4/11
to UML Forum
Since foo depends on goo, I think a dependency link
foo......>goo
is needed. With a stereotype <<includes>>.

But to show that goo is within the foo namespace you might give it the
name
foo::goo
In the diagram.

If foo has no operations or attributes then it might be shown as a
package and you use that inclusion --(+) thingy?

Jim Logan

unread,
Aug 4, 2011, 6:44:16 PM8/4/11
to netskink, umlf...@googlegroups.com
John,

You can define a class within a class in UML 2. The qualified name for "goo" would be "foo::goo". If you then drag both classes onto the same class diagram you can expose the containment relationship that looks like this:


-Jim

netskink

unread,
Aug 5, 2011, 10:13:27 AM8/5/11
to UML Forum
RJB, JIM,

Many thanks. That makes sense.

Thanks again,

John

Michael Jesse Chonoles

unread,
Aug 6, 2011, 12:00:39 PM8/6/11
to umlf...@googlegroups.com
You should, depending on the tool, be able to use the (+) from a class to an inner class. I don't beleive a dependency is needed, if it were, it would be bi-directional.


From: RJB <rbot...@csusb.edu>
To: UML Forum <umlf...@googlegroups.com>
Sent: Thursday, August 4, 2011 2:50 PM
Subject: [UML Forum] Re: how to diagram a class which contains the definition of another class?
--
You received this message because you are subscribed to the Google
Groups "UML Forum" group.
Public website: www.umlforum.com
To post to this group, send email to umlf...@googlegroups.com
To unsubscribe from this group, send email to
umlforum+unsub...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/umlforum?hl=en?hl=en


RJB

unread,
Aug 6, 2011, 8:06:29 PM8/6/11
to UML Forum
I checked the UML2.0 standard and classes can have nestedClassifiers.
But I couldn't find the notation! Perhaps I missed it?

On Aug 6, 9:00 am, Michael Jesse Chonoles <mjchono...@yahoo.com>
wrote:
> You should, depending on the tool, be able to use the (+) from a class to an inner class. I don't beleive a dependency is needed, if it were, it would be bi-directional.
>
> ________________________________
> From: RJB <rbott...@csusb.edu>
> umlforum+u...@googlegroups.com

Michael Jesse Chonoles

unread,
Aug 6, 2011, 11:28:36 PM8/6/11
to umlf...@googlegroups.com
Perhaps it's in the infrastructure, but the (+) symbol indicates namespace containment.
Michael


From: RJB <rbot...@csusb.edu>
To: UML Forum <umlf...@googlegroups.com>
Sent: Saturday, August 6, 2011 8:06 PM

> For more options, visit this group athttp://groups.google.com/group/umlforum?hl=en?hl=en

--
You received this message because you are subscribed to the Google
Groups "UML Forum" group.
Public website: www.umlforum.com
To post to this group, send email to umlf...@googlegroups.com
To unsubscribe from this group, send email to
Reply all
Reply to author
Forward
0 new messages