[Uml-devel] [Bug 59049] getters/setters are private in generated java sources

Dave Jernigan djernigan at loyaltongroup.com
Tue Feb 13 18:53:26 UTC 2007


------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=59049         




------- Additional Comments From djernigan loyaltongroup com  2007-02-13 19:53 -------
If it is possible to differentiate the accessor method scope from the attribute scope, I don't see a way to indicate this in the interface.

To be truly useful for Java code generation, here are the rules:

- if scope is private, create a private field with *no* accessors.
- if scope is public, create a *private* field with *public*-scope accessors.

// Fields
  private int myPrivateAttribute;
  private int myPublicAttribute;

...

// Accessor methods

// There should be no accessors for myPrivateAttribute!

  /**
   * Set the value of myPublicAttribute
   *  param newVar the new value of myPublicAttribute
   */
  private void setMyPublicAttribute ( int newVar ) {
    myPublicAttribute = newVar;
  }

  /**
   * Get the value of myPublicAttribute
   *  return the value of myPublicAttribute
   */
  private int getMyPublicAttribute ( ) {
    return myPublicAttribute;
  }




More information about the umbrello-devel mailing list