Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5bb2b53

Browse files
committed
Generate AnnotationTypes and refactor some codes
1 parent ec55e2e commit 5bb2b53

20 files changed

+979
-251
lines changed

JavaCodeGenerator.js

Lines changed: 208 additions & 105 deletions
Large diffs are not rendered by default.

JavaReverseEngineer.js

Lines changed: 120 additions & 102 deletions
Large diffs are not rendered by default.

LICENSE

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Copyright (c) 2014 MKLab. All rights reserved.
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a
4+
copy of this software and associated documentation files (the "Software"),
5+
to deal in the Software without restriction, including without limitation
6+
the rights to use, copy, modify, merge, publish, distribute, sublicense,
7+
and/or sell copies of the Software, and to permit persons to whom the
8+
Software is furnished to do so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in
11+
all copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
18+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
19+
DEALINGS IN THE SOFTWARE.

README.md

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ Belows are the rules to convert from UML model elements to Java source codes.
2828

2929
### UMLAttribute
3030

31-
* converted to _Java Member Variable_.
31+
* converted to _Java Field_.
3232
* `visibility` property to one of modifiers `public`, `protected`, `private` and none.
33-
* `name` property to member variable identifier.
34-
* `type` property to member variable type.
33+
* `name` property to field identifier.
34+
* `type` property to field type.
3535
* `multiplicity` property to array type.
3636
* `isStatic` property to `static` modifier.
3737
* `isLeaf` property to `final` modifier.
@@ -66,10 +66,10 @@ Belows are the rules to convert from UML model elements to Java source codes.
6666

6767
### UMLAssociationEnd
6868

69-
* converted to _Java Member Variable_.
69+
* converted to _Java Field_.
7070
* `visibility` property to one of modifiers `public`, `protected`, `private` and none.
71-
* `name` property to member variable identifier.
72-
* `type` property to member variable type.
71+
* `name` property to field identifier.
72+
* `type` property to field type.
7373
* If `multiplicity` is one of `0..*`, `1..*`, `*`, then collection type (`java.util.List<>` when `isOrdered` = `true` or `java.util.Set<>`) is used.
7474
* `defaultValue` property to initial value.
7575
* Documentation property to JavaDoc comment.
@@ -177,3 +177,8 @@ Belows are the rules to convert from Java source code to UML model elements.
177177
* converted to _UMLClass_ with stereotype `<<annotationType>>`.
178178
* Annotation type elements to _UMLOperation_. (Default value to a Tag with `name="default"`).
179179
* JavaDoc comment to Documentation.
180+
181+
182+
---
183+
184+
Licensed under the MIT license (see LICENSE file).

main.js

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323

2424
/*jslint vars: true, plusplus: true, devel: true, nomen: true, indent: 4, maxerr: 50, regexp: true */
2525
/*global define, $, _, window, staruml, type, appshell, document */
26+
2627
define(function (require, exports, module) {
2728
"use strict";
2829

@@ -53,7 +54,8 @@ define(function (require, exports, module) {
5354
CMD_JAVA_CONFIGURE = 'java.configure';
5455

5556
/**
56-
* CommandManager.execute로부터 파라미터를 받아서 코드 생성 가능하게 한다.
57+
* Command Handler for Java Generate
58+
*
5759
* @param {Element} base
5860
* @param {string} path
5961
* @param {Object} options
@@ -63,7 +65,7 @@ define(function (require, exports, module) {
6365
var result = new $.Deferred();
6466

6567
// If options is not passed, get from preference
66-
options = (options ? options : JavaPreferences.getGenOptions());
68+
options = options || JavaPreferences.getGenOptions();
6769

6870
// If base is not assigned, popup ElementPicker
6971
if (!base) {
@@ -116,19 +118,15 @@ define(function (require, exports, module) {
116118
}
117119

118120
/**
119-
* CommandManager.execute로부터 파라미터를 받아서 코드 역공학이 가능하게 한다.
120-
* e.g.) options = {
121-
* path: "/User/niklaus/...",
122-
* files: [ "....java", ".java" ],
123-
* typeHiarachy: true
124-
* packageOverview: true
125-
* packageStructure: true
126-
* }
127-
* 파라미터가 없으면 baseModel, targetDir을 사용한다.
128-
* Must return $.Promise
121+
* Command Handler for Java Reverse
122+
*
123+
* @param {string} basePath
124+
* @param {Object} options
125+
* @return {$.Promise}
129126
*/
130127
function _handleReverse(basePath, options) {
131128
var result = new $.Deferred();
129+
132130
// If options is not passed, get from preference
133131
options = JavaPreferences.getRevOptions();
134132

@@ -150,6 +148,10 @@ define(function (require, exports, module) {
150148
return result.promise();
151149
}
152150

151+
152+
/**
153+
* Popup PreferenceDialog with Java Preference Schema
154+
*/
153155
function _handleConfigure() {
154156
CommandManager.execute(Commands.FILE_PREFERENCES, JavaPreferences.getId());
155157
}

unittest-files/generate/CodeGenTestModel.umlj

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)