important ! it's a fork of Java Extension for StraUML (https://github.com/staruml/staruml-java)
This extension for StarUML(http://staruml.io) support to generate TypeScript code from UML model and to reverse TypeScript code to UML model. Install this extension from Extension Manager of StarUML.
Note This extensions do not provide perfect reverse engineering which is a test and temporal feature. If you need a complete reverse engineering feature, please check other professional reverse engineering tools.
Note This extension is based on TypeScript 1.7 Specification.
- Click the menu (
Tools > TypeScript > Generate Code...) - Select a base model (or package) that will be generated to TypeScript.
- Select a folder where generated TypeScript source files will be placed.
Belows are the rules to convert from UML model elements to TypeScript source codes.
- converted to TypeScript Class. (as a separate
.TypeScriptfile) visibilityto one of modifierspublic,protected,privateand none.isAbstractproperty toabstractmodifier.isFinalSpecializationandisLeafproperty tofinalmodifier.- Default constructor is generated.
- All contained types (UMLClass, UMLInterface, UMLEnumeration) are generated as inner type definition.
- Documentation property to TypeScriptDoc comment.
- converted to TypeScript Field.
visibilityproperty to one of modifierspublic,protected,privateand none.nameproperty to field identifier.typeproperty to field type.multiplicityproperty to array type.isStaticproperty tostaticmodifier.isLeafproperty tofinalmodifier.defaultValueproperty to initial value.- Documentation property to TypeScriptDoc comment.
- converted to TypeScript Methods.
visibilityproperty to one of modifierspublic,protected,privateand none.nameproperty to method identifier.isAbstractproperty toabstractmodifier.isStaticproperty tostaticmodifier.- UMLParameter to TypeScript 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=truetofinalmodifier of parameter. - Documentation property to TypeScriptDoc comment.
- converted to TypeScript Interface. (as a separate
.TypeScriptfile) visibilityproperty to one of modifierspublic,protected,privateand none.- Documentation property to TypeScriptDoc comment.
- converted to TypeScript Enum. (as a separate
.TypeScriptfile) visibilityproperty to one of modifierspublic,protected,privateand none.- UMLEnumerationLiteral to literals of enum.
- converted to TypeScript 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 (TypeScript.util.List<>whenisOrdered=trueorTypeScript.util.Set<>) is used. defaultValueproperty to initial value.- Documentation property to TypeScriptDoc comment.
- converted to TypeScript Extends (
extends). - Allowed only for UMLClass to UMLClass, and UMLInterface to UMLInterface.
- converted to TypeScript Implements (
implements). - Allowed only for UMLClass to UMLInterface.
- Click the menu (
Tools > TypeScript > Reverse Code...) - Select a folder containing TypeScript source files to be converted to UML model elements.
TypeScriptReversemodel will be created in the Project.
Belows are the rules to convert from TypeScript source code to UML model elements.
- converted to UMLPackage.
- converted to UMLClass.
- Class name to
nameproperty. - Type parameters to UMLTemplateParameter.
- Access modifier
public,protectedandprivatetovisibilityproperty. abstractmodifier toisAbstractproperty.finalmodifier toisLeafproperty.- Constructors to UMLOperation with stereotype
<<constructor>>. - All contained types (UMLClass, UMLInterface, UMLEnumeration) are generated as inner type definition.
- TypeScriptDoc comment to Documentation.
-
converted to UMLAttribute if "Use Association" is off in Preferences.
-
Field type to
typeproperty.- Primitive Types :
typeproperty has the primitive type name as string. T[](array),TypeScript.util.List<T>,TypeScript.util.Set<T>or its decendants:typeproperty refers toTwith multiplicity*.T(User-Defined Types) :typeproperty refers to theTtype.- Otherwise :
typeproperty has the type name as string.
- Primitive Types :
-
Access modifier
public,protectedandprivatetovisibilityproperty. -
staticmodifier toisStaticproperty. -
finalmodifier toisLeafandisReadOnlyproperty. -
transientmodifier to a Tag withname="transient"andchecked=true. -
volatilemodifier to a Tag withname="volatile"andchecked=true. -
Initial value to
defaultValueproperty. -
TypeScriptDoc comment to Documentation.
-
converted to (Directed) UMLAssociation if "Use Association" is on in Preferences and there is a UML type element (UMLClass, UMLInterface, or UMLEnumeration) correspond to the field type.
-
Field type to
end2.referenceproperty.T[](array),TypeScript.util.List<T>,TypeScript.util.Set<T>or its decendants:referenceproperty refers toTwith multiplicity*.T(User-Defined Types) :referenceproperty refers to theTtype.- Otherwise : converted to UMLAttribute, not UMLAssociation.
-
Access modifier
public,protectedandprivatetovisibilityproperty. -
TypeScriptDoc comment to Documentation.
- converted to UMLOperation.
- Type parameters to UMLTemplateParameter.
- Access modifier
public,protectedandprivatetovisibilityproperty. staticmodifier toisStaticproperty.abstractmodifier toisAbstractproperty.finalmodifier toisLeafproperty.synchronizedmodifier toconcurrency="concurrent"property.nativemodifier to a Tag withname="native"andchecked=true.strictfpmodifier to a Tag withname="strictfp"andchecked=true.throwsclauses toraisedExceptionsproperty.- TypeScriptDoc comment to Documentation.
- converted to UMLInterface.
- Class name to
nameproperty. - Type parameters to UMLTemplateParameter.
- Access modifier
public,protectedandprivatetovisibilityproperty. - TypeScriptDoc comment to Documentation.
- converted to UMLEnumeration.
- Enum name to
nameproperty. - Type parameters to UMLTemplateParameter.
- Access modifier
public,protectedandprivatetovisibilityproperty. - Enum constants are converted to UMLEnumerationLiteral.
- TypeScriptDoc comment to Documentation.
- converted to UMLClass with stereotype
<<annotationType>>. - Annotation type elements to UMLOperation. (Default value to a Tag with
name="default"). - TypeScriptDoc comment to Documentation.
Licensed under the MIT license (see LICENSE file).