Book a Demo

Author Topic: Diagramming Nested Classes  (Read 5352 times)

jeshaw2

  • EA User
  • **
  • Posts: 701
  • Karma: +0/-0
  • I'm a Singleton, what pattern are you?
    • View Profile
Diagramming Nested Classes
« on: March 14, 2005, 12:39:08 pm »
Java allows Nested classes of various types.  This includes: static and inner.   Inner classes are further classified as member, local, and anonymmous.

I'm wondering how the nesting of these classes are modeled in UML 2.0 ala EA?

For the curious, here is sample code for a Member Class:

Code: [Select]

class top {
   int i = 33;

   class my NestedMember { //member inner class
            int k = i;
            int foo() {return this.k;}
   }

   void doCalclulations() {

           myNestedMember mn1 = new myNestedMember;
           myNestedMember mn2 = new myNestedMember;
           mn1.k = 654 * mn2.foo();
    }
}


thanks
Jim
Verbal Use Cases aren't worth the paper they are written upon.

thomaskilian

  • Guest
Re: Diagramming Nested Classes
« Reply #1 on: March 15, 2005, 04:17:03 am »
Try reverse engineering ;)

jeshaw2

  • EA User
  • **
  • Posts: 701
  • Karma: +0/-0
  • I'm a Singleton, what pattern are you?
    • View Profile
Re: Diagramming Nested Classes
« Reply #2 on: March 15, 2005, 06:16:56 am »
I'd love to try reverse engineering, but my product license does not include that feature.
Verbal Use Cases aren't worth the paper they are written upon.

thomaskilian

  • Guest
Re: Diagramming Nested Classes
« Reply #3 on: March 15, 2005, 08:30:34 am »
Just tried and EA refuses to import that code (error on line 4)  :-[
If you omit the "my" it imports. I can send you the XMI by mail if you wish.
« Last Edit: March 15, 2005, 08:39:44 am by thomaskilian »

jeshaw2

  • EA User
  • **
  • Posts: 701
  • Karma: +0/-0
  • I'm a Singleton, what pattern are you?
    • View Profile
Re: Diagramming Nested Classes
« Reply #4 on: March 15, 2005, 08:54:08 am »
My appologies for lousy keying skills.  I've successfully compiled this code:

Code: [Select]

class top {
   int i = 33;

  class myNestedMember { //member inner class
      int k = i;
      int foo() {return this.k;}
  }

  void doCalclulations() {

      myNestedMember mn1 = new myNestedMember();
      myNestedMember mn2 = new myNestedMember();
      mn1.k = 654 * mn2.foo();
  }
}



I'd appreciate whatever you can mail to me.
Verbal Use Cases aren't worth the paper they are written upon.

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8089
  • Karma: +118/-20
    • View Profile
Re: Diagramming Nested Classes
« Reply #5 on: March 15, 2005, 01:11:11 pm »
Hi,

EA will reverse engineer inner classes and put them under the outer class in the tree.  If you need a more visual representation then use the Nesting connector that is available on the diagram. (Or both)

Ultimately, if you can't use the code engineering you don't need to worry about the constraints of what code engineering expects.

Simon