Sparx Systems Forum
Enterprise Architect => Uml Process => Topic started by: SPars 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?
-
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.
-
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.
-
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?
-
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
-
That is perfect - thanks for the help!