Book a Demo

Author Topic: Code Generation with Java/associated attributes  (Read 2894 times)

raymanoz

  • EA Novice
  • *
  • Posts: 1
  • Karma: +0/-0
  • I love YaBB 1 Gold!
    • View Profile
Code Generation with Java/associated attributes
« on: January 07, 2003, 02:16:45 am »
Hi all,

Just started using EA, and think it is a brilliant application. Well worth every penny. But, I have a question (or is it a bug report?  ???)

I've created a bunch of classes, and associations, and attempted to generate the stubs from my diagrams (Java). It all seems to work quite nicely, except for the associations. I want to have the associations private, and settor/gettor functions to access this private attribute. So, I set the Access on Target Role to private, and in View|Options|Attribute/Operations, I've made sure that "Generate Get/Set methods for associated attributes" is checked. But when I generate the code, there are not Get/Set methods. What am I doing wrong?

To get around this, I've just added an attribute to the class with the same name as the target role, and checked the property checkbox. This now generates nice code, but I feel that this is not the right way to do it.

Am I doing something wrong? Or is this a bug. I've had a search through the forum, and can't seem to find any related threads. Hopefully, someone can point me in the right direction.  :-/

Cheers,
Raymond Barlow

Tjerk

  • EA User
  • **
  • Posts: 231
  • Karma: +1/-0
    • View Profile
Re: Code Generation with Java/associated attribute
« Reply #1 on: January 07, 2003, 04:02:38 am »
Hi Raymond,

It is not really a bug. It's the way it works with EA for already a long time. I guess EA assumes that classes and attributes are created first, and then the assosiations are made. In that fasion, you can select your attributes in the source / target roles.

Changing e.g. the role from public to private doesn't change your attribute and the generated code. The logic might be that not every role is an attribute of the element pointed to. I'm not sure on the exact UML specs.

I would like to see the same behaviour as you imply (at least default or using a request "add attribute?" to the user), so I guess this post becomes a feature request!

Hope this answers your question (doesn't solve the problem  :-/).

Greetings,
Tjerk