[Jiemamy-notify] commit [1974] [CORE-76] 現状のソース構成に追随する。

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2008年 9月 30日 (火) 00:50:54 JST


Revision: 1974
          http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=jiemamy&view=rev&rev=1974
Author:   shin1
Date:     2008-09-30 00:50:53 +0900 (Tue, 30 Sep 2008)

Log Message:
-----------
[CORE-76]現状のソース構成に追随する。

Modified Paths:
--------------
    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/resources/ChangeSupportImpl.vm


-------------- 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-28 23:37:16 UTC (rev 1973)
+++ sandbox/org.jiemamy.core.eventcodegen/trunk/org.jiemamy.core.eventcodegen/src/main/java/org/jiemamy/core/eventcodegen/JiemamyModelDoclet.java	2008-09-29 15:50:53 UTC (rev 1974)
@@ -115,13 +115,15 @@
 		List<String> importClasses = new ArrayList<String>();
 		addImportClasses(importClasses, classDoc.qualifiedTypeName());
 		addImportClasses(importClasses,
-				"org.jiemamy.spec.util.ModelChangeListener");
+				"org.jiemamy.spec.event.ModelChangeListener");
 		addImportClasses(importClasses,
 				"org.jiemamy.spec.event.ObservableCollectionChangeEvent");
 		List<CollectionProperty> properties = new ArrayList<CollectionProperty>();
 		MethodDoc[] methods = classDoc.methods();
 		for (MethodDoc methodDoc : methods) {
-			if (methodDoc.name().startsWith("get") == false) {
+			if (methodDoc.name().startsWith("get") == false
+					|| methodDoc.parameters().length != 0) {
+				// getで始まらないか、引数を受けるメソッドは処理対象にしない。
 				continue;
 			}
 			Type type = methodDoc.returnType();
@@ -172,8 +174,7 @@
 				dirForImpl.mkdirs();
 			}
 			VelocityContext velocityContext = new VelocityContext();
-			// 実装のパッケージ名には"spec"を含まない。
-			velocityContext.put("package", packageName.replaceAll("\\.spec", ""));
+			velocityContext.put("package", packageName);
 			velocityContext.put("importClasses", importClasses);
 			velocityContext.put("modelClassName", classDoc.name().toString());
 			velocityContext.put("modelClassNameLower", classDoc.name()
@@ -196,7 +197,7 @@
 			addImportClasses(importClasses, "java.util.List");
 			addImportClasses(importClasses, "java.util.ArrayList");
 			addImportClasses(importClasses,
-					"org.jiemamy.spec.util.ModelChangeEvent");
+					"org.jiemamy.spec.event.ModelChangeEvent");
 			if (properties.size() > 0) {
 				importClasses
 						.add("org.jiemamy.spec.event.ObservableCollectionChangeListener");
@@ -216,10 +217,12 @@
 			writer.close();
 
 			// ChangeSupportImplの生成
+			velocityContext.put("package", packageName.replaceAll("\\.spec", ""));
 			addImportClasses(importClasses, "java.util.List");
 			addImportClasses(importClasses, "java.util.ArrayList");
+			addImportClasses(importClasses, "org.jiemamy.spec.event.Observable");
 			addImportClasses(importClasses,
-					"org.jiemamy.spec.util.ModelChangeEvent");
+					"org.jiemamy.spec.event.ModelChangeEvent");
 			if (properties.size() > 0) {
 				importClasses
 						.add("org.jiemamy.spec.event.ObservableCollectionChangeListener");

Modified: sandbox/org.jiemamy.core.eventcodegen/trunk/org.jiemamy.core.eventcodegen/src/main/resources/ChangeSupportImpl.vm
===================================================================
--- sandbox/org.jiemamy.core.eventcodegen/trunk/org.jiemamy.core.eventcodegen/src/main/resources/ChangeSupportImpl.vm	2008-09-28 23:37:16 UTC (rev 1973)
+++ sandbox/org.jiemamy.core.eventcodegen/trunk/org.jiemamy.core.eventcodegen/src/main/resources/ChangeSupportImpl.vm	2008-09-29 15:50:53 UTC (rev 1974)
@@ -57,7 +57,7 @@
 	 * 
 	 * @see #fireModelChange(ModelChangeEvent)
 	 */
-	private ModelChangeListener ${modelClassNameLower}ChangeListener = new ModelChangeListener() {
+	private ModelChangeListener modelChangeListener = new ModelChangeListener() {
 		
 		/**
 		 * {@inheritDoc}
@@ -74,7 +74,7 @@
 	 * @category instance creation
 	 */
 	public ${modelClassName}ChangeSupportImpl(${modelClassName} source) {
-		source.addModelChangeListener(${modelClassNameLower}ChangeListener);
+		source.getAdapter(Observable.class).addModelChangeListener(modelChangeListener);
 #foreach($property in $properties)
 		((${property.observableCollectionClassSimpleName}<#if(${property.map} != false)${property.mapKeyClassSimpleName}, #end${property.elementClassSimpleName}>) source.get${property.nameUpper}()).addListener(${property.name}CollectionChangeListener);
 #end


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