File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes OO, Patterns, UML and Refactoring and the fly likes Nested Classes in UML Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » OO, Patterns, UML and Refactoring
Bookmark "Nested Classes in UML" Watch "Nested Classes in UML" New topic

Nested Classes in UML

Gustavo Adolpho Bonesso
Ranch Hand

Joined: May 11, 2002
Posts: 103
How to represent a Nested Class in UML ?

Gustavo Adolpho Bonesso<br />SCJP1.4
Lasse Koskela

Joined: Jan 23, 2002
Posts: 11962
The last time I needed to draw an inner class into a class diagram (which was a long time ago), I ended up using the same class notation for both inner and regular classes. If the inner class is non-static, you can associate it to the outer class using a composition. Otherwise, I would just rely on the name ("MyOuter.MyInner") to communicate my intention.
However, I would be interested to know what others think about this as I really didn't do much research on existing practices at the time.

Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Gustavo Adolpho Bonesso
Ranch Hand

Joined: May 11, 2002
Posts: 103
Thank you, Lasse, i like the composition aproach to do the job...
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8927

Does UML 2.0 talk about nested classes?

I agree. Here's the link:
subject: Nested Classes in UML
It's not a secret anymore!