Book a Demo

Author Topic: Getters and Setters  (Read 3634 times)

dkunzman

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Getters and Setters
« on: November 16, 2007, 07:29:08 am »
Hi -

I am using EA version 6.5.803 and have a dozen private members in my class.  Can I automate creating getters and setters?

Doug

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: Getters and Setters
« Reply #1 on: November 16, 2007, 08:39:13 am »
Doug,

The short answer is Yes. You'll find the necessary options in two places.

[I'll use an example with VB.Net, but other languages are essentially the same.]

Add an attribute to its class as you normally would. Once you have saved the attribute - don't forget this step - check the Property box on the dialog. This will invoke the Create Property Implementation dialog. There are several options available, and I'll leave you to experiment. For now pay particular attention to the Read and Write check boxes; you can set these are you require.

Having done this, EA will create the necessary property in your class. You'll see it when you leave the attribute dialog.

Now take a look at the Tools | Options | Source Code Engineering dialog. Near the bottom of the pane you will see several options that determine how property and attribute names will be determined. Set these as appropriate for your local coding standards.

Now you've got your property set up, and if you generate code you should get the correct output.

HTH, David
No, you can't have it!

dkunzman

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: Getters and Setters
« Reply #2 on: November 16, 2007, 09:38:48 am »
I just don't see were in the property dialog it has a read write check box.  I'm using version 6.5803 of EA

Doug

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: Getters and Setters
« Reply #3 on: November 16, 2007, 09:57:47 am »
Sorry Doug,

I was using 7.0, build 818 for my example.

I can't quite remember where the equivalent stuff is for version 6.5. I've pulled down a 6.5 help file to jog my memory.

Look for the Property check box to the right (and a bit below) the Name field on the Attributes dialog. If I remember correctly, checking this box invoked the dialog you want back in the EA 6.5 days. If not, check the box, save the property, and then check the details tab. I think you'll find it.

Unfortunately there seems to be very little information on this in the 6.5 help file. Sparx has been making significant improvements in the documentation, but these are largely geared to version 7.0.

David
No, you can't have it!