[Jiemamy-notify] commit [1919] 出力するソース内で、importの定義が重複してしまう可能性があった実装を修正した。

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2008年 9月 15日 (月) 19:38:23 JST


Revision: 1919
          http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=jiemamy&view=rev&rev=1919
Author:   shin1
Date:     2008-09-15 19:38:22 +0900 (Mon, 15 Sep 2008)

Log Message:
-----------
出力するソース内で、importの定義が重複してしまう可能性があった実装を修正した。

Modified Paths:
--------------
    sandbox/org.jiemamy.core.eventcodegen/trunk/org.jiemamy.core.eventcodegen/src/main/java/org/jiemamy/core/eventcodegen/JiemamyModelDoclet.java


-------------- next part --------------
Modified: sandbox/org.jiemamy.core.eventcodegen/trunk/org.jiemamy.core.eventcodegen/src/main/java/org/jiemamy/core/eventcodegen/JiemamyModelDoclet.java
===================================================================
--- sandbox/org.jiemamy.core.eventcodegen/trunk/org.jiemamy.core.eventcodegen/src/main/java/org/jiemamy/core/eventcodegen/JiemamyModelDoclet.java	2008-09-15 10:14:37 UTC (rev 1918)
+++ sandbox/org.jiemamy.core.eventcodegen/trunk/org.jiemamy.core.eventcodegen/src/main/java/org/jiemamy/core/eventcodegen/JiemamyModelDoclet.java	2008-09-15 10:38:22 UTC (rev 1919)
@@ -32,9 +32,9 @@
 public class JiemamyModelDoclet extends Doclet {
 	public List<JiemamyModel> model;
 	public Map<Class<?>, CollectionProperty> collectionProperties = new HashMap<Class<?>, CollectionProperty>();
-	public static final String OUTPUTDIR = "target/";
-
+	// public static final String OUTPUTDIR = "target/";
 	// public static final String OUTPUTDIR = "src/main/java/";
+	public static final String OUTPUTDIR = "../org.jiemamy.core/src/main/java/";
 
 	public static LanguageVersion languageVersion() {
 		return LanguageVersion.JAVA_1_5;
@@ -113,10 +113,11 @@
 		System.out.println(classDoc.qualifiedTypeName() + ":"
 				+ getPackageName(classDoc));
 		List<String> importClasses = new ArrayList<String>();
-		importClasses.add(classDoc.qualifiedTypeName());
-		importClasses.add("org.jiemamy.core.event.ModelChangeListener");
-		importClasses
-				.add("org.jiemamy.core.event.ObservableCollectionChangeEvent");
+		addImportClasses(importClasses, classDoc.qualifiedTypeName());
+		addImportClasses(importClasses,
+				"org.jiemamy.core.event.ModelChangeListener");
+		addImportClasses(importClasses,
+				"org.jiemamy.core.event.ObservableCollectionChangeEvent");
 		List<CollectionProperty> properties = new ArrayList<CollectionProperty>();
 		FieldDoc[] fields = classDoc.fields();
 		for (FieldDoc fieldDoc : fields) {
@@ -167,6 +168,8 @@
 					.toString().substring(0, 1).toLowerCase()
 					+ classDoc.name().toString().substring(1));
 			velocityContext.put("properties", properties);
+
+			// ChangeListenerの生成
 			Template listenerTemplate = Velocity
 					.getTemplate("ChangeListener.vm");
 			File file = new File(dir.getAbsolutePath() + "/"
@@ -177,11 +180,15 @@
 			writer.flush();
 			writer.close();
 
-			importClasses.add("java.util.List");
-			importClasses.add("java.util.ArrayList");
-			importClasses.add("org.jiemamy.core.event.ModelChangeEvent");
-			importClasses
-					.add("org.jiemamy.core.event.ObservableCollectionChangeListener");
+			// ChangeSupportの生成
+			addImportClasses(importClasses, "java.util.List");
+			addImportClasses(importClasses, "java.util.ArrayList");
+			addImportClasses(importClasses,
+					"org.jiemamy.core.event.ModelChangeEvent");
+			if (properties.size() > 0) {
+				importClasses
+						.add("org.jiemamy.core.event.ObservableCollectionChangeListener");
+			}
 			for (CollectionProperty property : properties) {
 				addImportClasses(importClasses, property
 						.getObservableCollectionClassName());


Jiemamy-notify メーリングリストの案内
Back to archive index