Book a Demo

Author Topic: Code Generation  (Read 6440 times)

SPars

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Code Generation
« on: August 14, 2008, 06:51:18 am »
I've created the basic class with some attributes.  However, I want the system to generate my getters and setters.  The help file talks about going to tools-options-generate ... there is no such menu option.

Going to project - transform doesn't generate any get/set methods.

thoughts?

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Code Generation
« Reply #1 on: August 14, 2008, 08:28:48 am »
The built-in C# and Java transformations take a public attribute, and convert it into a private attribute and public properties.  Other than this, you can click on the 'Property' checkbox in the attributes dialog for each attribute.

RoyC

  • EA Administrator
  • EA Practitioner
  • *****
  • Posts: 1297
  • Karma: +21/-4
  • Read The Help!
    • View Profile
Re: Code Generation
« Reply #2 on: August 14, 2008, 09:11:37 am »
What release are you using? Whereabouts in the Help is this reference to the Tool | Options | Generate menu option? You are right, it doesn't exist, and there shouldn't be a reference to it. I can't find it, but it might be in an older version of the Help.
Best Regards, Roy

SPars

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: Code Generation
« Reply #3 on: August 14, 2008, 11:22:05 pm »
Think I actually found it on your site, not in the help menu.

I did find the answer with the property check box - thanks.

The next question I have is that the getters/setters are not cased out correctly.

String someValue;

String getsomeValue();

A member variable's name can be any legal Java identifier and by convention begins with a lower case letter.  However, the set/get methods should be:

getSomeValue();

Is there somewhere to set this?

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: Code Generation
« Reply #4 on: August 15, 2008, 05:12:37 am »
Take a look at the Tools | Options | Source Code Generation dialog. Near the bottom you'll see an option for Capitalized Attribute Name for Properties. I think that's what you need to set.

I'm not sure whether EA stores this globally - in the registry - or on a per-model basis. If it is the latter case you'll need to set up a base project, edit EABase.EAP in your EA installation directory, or tweak the option for each relevant project.

David
No, you can't have it!

SPars

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: Code Generation
« Reply #5 on: August 15, 2008, 05:23:58 am »
That is perfect - thanks for the help!