This extension for StarUML(http://staruml.io) support to generate C# code from UML model and to reverse Java code to UML model. Install this extension from Extension Manager of StarUML. It is based on C# 2.0 specification.
- Click the menu (
Tools > C# > Generate Code...) - Select a base model (or package) that will be generated to C#.
- Select a folder where generated C# source files will be placed.
Belows are the rules to convert from UML model elements to Java source codes.
- converted to C# namespace (as a folder).
- converted to C# Class. (as a separate
.csfile) visibilityto one of modifierspublic,protected,privateand none.isAbstractproperty toabstractmodifier.isFinalSpecificationandisLeafproperty tosealedmodifier.- Default constructor is generated.
- All contained types (UMLClass, UMLInterface, UMLEnumeration) are generated as inner type definition.
- Documentation property to C#Doc comment.
- Annotation Type is converted to C# attribute class which extends System.Attribute and postfix of class is Attribute. (cf. class testAttribute:System.Attribute)
- converted to C# Field.
visibilityproperty to one of modifierspublic,protected,privateand none.nameproperty to field identifier.typeproperty to field type.multiplicityproperty to array type.isStaticproperty tostaticmodifier.isLeafproperty tosealedmodifier.defaultValueproperty to initial value.- Documentation property to C#Doc comment.
- converted to C# Methods.
visibilityproperty to one of modifierspublic,protected,privateand none.nameproperty to method identifier.isAbstractproperty toabstractmodifier.isStaticproperty tostaticmodifier.- UMLParameter to C# Method Parameters.
- UMLParameter's name property to parameter identifier.
- UMLParameter's type property to type of parameter.
- UMLParameter with
direction=returnto return type of method. When no return parameter,voidis used. - UMLParameter with
isReadOnly=truetosealedmodifier of parameter. - Documentation property to C#Doc comment.
- converted to C# Interface. (as a separate
.csfile) visibilityproperty to one of modifierspublic,protected,privateand none.- Documentation property to C#Doc comment.
- converted to C# enum. (as a separate
.csfile) visibilityproperty to one of modifierspublic,protected,privateand none.- UMLEnumerationLiteral to literals of enum.
- converted to C# Field.
visibilityproperty to one of modifierspublic,protected,privateand none.nameproperty to field identifier.typeproperty to field type.- If
multiplicityis one of0..*,1..*,*, then collection type (List<>whenisOrdered=trueorHashSet<>) is used. defaultValueproperty to initial value.- Documentation property to JavaDoc comment.
- converted to C# Extends (
:). - Allowed only for UMLClass to UMLClass, and UMLInterface to UMLInterface.
- converted to C# Implements (
:). - Allowed only for UMLClass to UMLInterface.