Book a Demo

Author Topic: java attributes getter/setter  (Read 4211 times)

angeliadam

  • EA Novice
  • *
  • Posts: 1
  • Karma: +0/-0
    • View Profile
java attributes getter/setter
« on: November 11, 2003, 03:24:34 pm »
I have a class diagram and am trying to automatically generate the getters & setters for attributes of a class.

I bring up the attributes editor and check the "Property" box for an attribute.  It brings up a "Create Property Implementation" dialog box that allows me to choose "Java" as my language.  The getters & setters generated by EA for java are not standard.

Normally in java, we capitalize the name of the attribute and prefix it with "get" or "set".   EA does not capitalize the name of the attribute.  It simply prepends "get" or "set" to it.  So, if I have an attribute named "cost", the getter should be "getCost", but EA generates "getcost".

Anyone know if I can modify this behavior?

jkorman

  • EA User
  • **
  • Posts: 99
  • Karma: +0/-0
    • View Profile
Re: java attributes getter/setter
« Reply #1 on: November 12, 2003, 07:38:13 pm »

Select  Tools->Options->Generation

Near the botton center is a checkbox labeled "Capitalized Attribute Name for Properties"

Also note above is a text box that allows entry of prefixes to remove when generating
the setters/getters. So by adding say "the" to the list

the attribute  int theIndex

 will generate

   int getIndex() and
   void setIndex(int newVal)

Hope this helps.

Jim