Book a Demo

Author Topic: Generate Get/Set methods for associated attributes  (Read 3420 times)

fabiopinheiro

  • EA Novice
  • *
  • Posts: 6
  • Karma: +0/-0
    • View Profile
Generate Get/Set methods for associated attributes
« on: September 20, 2004, 07:52:05 am »
Hi,
After to draw an associate with 2 class, the property (get/set) does not appear in my source class!
It also does not appear in the diagram and in the generated code source.

What is wrong?

I tried to create  one stereotype of the type associate, with the name (property), but not work.

Obs: In  EA menu: Tools\Options\Attribute/Operations the option (Generate Get/Set methods for associated attributes) is checked.

thanks,
Fábio Pinheiro

thomaskilian

  • Guest
Re: Generate Get/Set methods for associated attrib
« Reply #1 on: September 20, 2004, 12:30:49 pm »
Maybe you need to specify source and target role in the assoc. properties window?

fabiopinheiro

  • EA Novice
  • *
  • Posts: 6
  • Karma: +0/-0
    • View Profile
Re: Generate Get/Set methods for associated attrib
« Reply #2 on: September 21, 2004, 04:33:05 am »
Hi thomaskilian,
Ok,  I tried to modify these properties, but i did not obtain!

Sorry, but I 'm beggining in UML and EA. How can I modify the source role and the target role?

Do you have some idea?

thanks,
Fábio Pinheiro

thomaskilian

  • Guest
Re: Generate Get/Set methods for associated attrib
« Reply #3 on: September 21, 2004, 07:10:45 am »
Create a private attribute in class1. Check Property for this attribute and save it. Draw an association from class1 to class2. Open the properties window for the assoc. Go to the target role tab. Now you should see the attribute in the drop down list. After seletion you will see the public attribute near class2 (with a plus sign in front). Now you should see the code you desired after generating it.
« Last Edit: September 21, 2004, 07:11:43 am by thomaskilian »

benc

  • EA Administrator
  • EA User
  • *****
  • Posts: 200
  • Karma: +0/-0
    • View Profile
Re: Generate Get/Set methods for associated attrib
« Reply #4 on: September 23, 2004, 05:22:00 pm »
Hi Fábio,

You can create properties using the approach Thomas described and this is the right way to go.

In relation to your original post however- the generate Get/Set methods option is in error. Happily, there is a work around by "hardwiring" the getters/setters into the Code Templates. You would need to modfiy the "Linked Attribute" template for the language you are generating and type in the get/set methods there.

Sorry for the inconvenience- I hope the work around suffices for now.

Regards,
Ben