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
.cs
file) visibility
to one of modifierspublic
,protected
,private
and none.isAbstract
property toabstract
modifier.isFinalSpecification
andisLeaf
property tosealed
modifier.- 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.
visibility
property to one of modifierspublic
,protected
,private
and none.name
property to field identifier.type
property to field type.multiplicity
property to array type.isStatic
property tostatic
modifier.isLeaf
property tosealed
modifier.defaultValue
property to initial value.- Documentation property to C#Doc comment.
- converted to C# Methods.
visibility
property to one of modifierspublic
,protected
,private
and none.name
property to method identifier.isAbstract
property toabstract
modifier.isStatic
property tostatic
modifier.- UMLParameter to C# Method Parameters.
- UMLParameter's name property to parameter identifier.
- UMLParameter's type property to type of parameter.
- UMLParameter with
direction
=return
to return type of method. When no return parameter,void
is used. - UMLParameter with
isReadOnly
=true
tosealed
modifier of parameter. - Documentation property to C#Doc comment.
- converted to C# Interface. (as a separate
.cs
file) visibility
property to one of modifierspublic
,protected
,private
and none.- Documentation property to C#Doc comment.
- converted to C# enum. (as a separate
.cs
file) visibility
property to one of modifierspublic
,protected
,private
and none.- UMLEnumerationLiteral to literals of enum.
- converted to C# Field.
visibility
property to one of modifierspublic
,protected
,private
and none.name
property to field identifier.type
property to field type.- If
multiplicity
is one of0..*
,1..*
,*
, then collection type (List<>
whenisOrdered
=true
orHashSet<>
) is used. defaultValue
property 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.