开发者

Star UML: how to add get/set properties

开发者 https://www.devze.com 2022-12-09 22:57 出处:网络
I have started using Star UML application and its great. Is there a way to add get/set functions and foward/reverse engineer the code.

I have started using Star UML application and its great. Is there a way to add get/set functions and foward/reverse engineer the code.

Th开发者_Python百科anks


Create an operator then set the stereotype to CSharpProperty.

Example:

  1. Right-click the class in the Model Explorer
  2. Select Add -> Operation
  3. In the property pane add the CSharpProperty stereotype.
  4. Add a "return" parameter (right-click the new operation and select Add -> return)
  5. Set the Type to the property type (e.g. int, string, etc.)
  6. Set the DiretionKind to Return

The above steps should produce C# code with both an accessor and modifier when StarUML generates the code.


You just need to install a tool named "Generate Getters and Setters".

  1. Open the StarUML and select Tools -> Extension Manager...
  2. Search "Generate Getters and Setters" and install it
  3. Reload the StarUML
  4. Select attributes or classes first and then select Tools -> Generate Getters Setters
    (Ctrl+Alt+G)

staruml-gettersetter in GitHub


I don't think that there is an easy way for automation in generating getters and setters. The development of StarUML stopped 4 years ago. An alternative would be nice.

0

精彩评论

暂无评论...
验证码 换一张
取 消