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:
- Right-click the class in the Model Explorer
- Select Add -> Operation
- In the property pane add the CSharpProperty stereotype.
- Add a "return" parameter (right-click the new operation and select Add -> return)
- Set the Type to the property type (e.g. int, string, etc.)
- 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".
- Open the StarUML and select Tools -> Extension Manager...
- Search "Generate Getters and Setters" and install it
- Reload the StarUML
- 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.
精彩评论