[Jiemamy-notify] commit [2224] Modelの条件をIdentifiableを実装しているもの、としていたが、以下のように変更。

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2008年 12月 9日 (火) 00:28:13 JST


Revision: 2224
          http://svn.sourceforge.jp/view?root=jiemamy&view=rev&rev=2224
Author:   shin1
Date:     2008-12-09 00:28:13 +0900 (Tue, 09 Dec 2008)

Log Message:
-----------
Modelの条件をIdentifiableを実装しているもの、としていたが、以下のように変更。
・Adaptableを実装している & Identifiableを実装している
または
・Adaptebleを実装している & Constraintを実装している

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/java/org/jiemamy/core/eventcodegen/ModelClassInfo.java
    sandbox/org.jiemamy.core.eventcodegen/trunk/org.jiemamy.core.eventcodegen/src/main/resources/jiemamy-event.dicon.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-12-08 14:53:17 UTC (rev 2223)
+++ sandbox/org.jiemamy.core.eventcodegen/trunk/org.jiemamy.core.eventcodegen/src/main/java/org/jiemamy/core/eventcodegen/JiemamyModelDoclet.java	2008-12-08 15:28:13 UTC (rev 2224)
@@ -15,7 +15,9 @@
 import org.apache.velocity.app.Velocity;
 import org.apache.velocity.exception.ParseErrorException;
 import org.apache.velocity.exception.ResourceNotFoundException;
+import org.jiemamy.Adaptable;
 import org.jiemamy.model.Identifiable;
+import org.jiemamy.model.constraint.Constraint;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -34,8 +36,7 @@
  * <li>Main Class:com.sun.tools.javadoc.Main</li>
  * <li>Program Argumenets: -doclet \
  * org.jiemamy.core.eventcodegen.JiemamyModelDoclet -sourcepath \
- * ../org.jiemamy.core/src/main/java -subpackages org.jiemamy.model
- * -private</li>
+ * ../org.jiemamy.core/src/main/java -subpackages org.jiemamy.model -private</li>
  * </ul>
  * </li>
  * <li>実行後、自動生成された以下の場所にあるフォルダに対して 「Source-Organize
@@ -122,23 +123,29 @@
 				&& !classDoc.simpleTypeName().endsWith("Adapter")) {
 			try {
 				Class<?> clazz = Class.forName(classDoc.qualifiedTypeName());
-				if (Identifiable.class.isAssignableFrom(clazz)) {
-					processModelAccessor(classDoc);
+				if (Adaptable.class.isAssignableFrom(clazz)
+						&& (Identifiable.class.isAssignableFrom(clazz) || Constraint.class.isAssignableFrom(clazz))) {
+					// JiemamyのModelである条件とは?
+					// * Adapterble & Identifiable
+					// …だけでは、カバーできない、IDを持たないConstraint系もある。そこで、
+					// * Adapterble & Constraint
+					// も加えてカバーしたつもり。
+					processModelAccessor(classDoc, clazz);
 				}
 			} catch (Exception ex) {
 				return;
 			}
 		}
 	}
-	
+
 	static void getXXXHoge() {
-		
+
 	}
 
 	static void getXXXFoo() {
-		
+
 	}
-	
+
 	/**
 	 * {@link JiemamyModel}を解析し、情報を抜き出す。
 	 * <p>
@@ -147,12 +154,13 @@
 	 * </p>
 	 * 
 	 * @param classDoc
+	 * @param clazz
 	 * @throws Exception
 	 * @throws ParseErrorException
 	 * @throws ResourceNotFoundException
 	 */
-	private static void processModelAccessor(ClassDoc classDoc) throws ResourceNotFoundException, ParseErrorException,
-			Exception {
+	private static void processModelAccessor(ClassDoc classDoc, Class<?> clazz) throws ResourceNotFoundException,
+			ParseErrorException, Exception {
 		// Importが必要なClass
 		List<String> importClasses = new ArrayList<String>();
 		importClasses.add("org.jiemamy.event.AbstractModelChangeSupport");
@@ -208,7 +216,8 @@
 			}
 
 			String modelClassName = classDoc.name().toString().replace("Impl", "");
-			importClasses.add(getPackageName(classDoc) + "." + modelClassName); // Model Interface
+			importClasses.add(getPackageName(classDoc) + "." + modelClassName); // Model
+			// Interface
 			if (properties.size() > 0) {
 				importClasses.add("java.lang.ref.WeakReference");
 				importClasses.add("org.slf4j.Logger");
@@ -218,10 +227,12 @@
 				importClasses.add("org.seasar.framework.beans.impl.BeanDescImpl");
 				importClasses.add("org.jiemamy.event.ObservableCollectionChangeEvent");
 				importClasses.add("org.jiemamy.event.ObservableCollectionChangeEvent.Timing");
-				importClasses.add(classDoc.qualifiedName()); // Model Implementation
+				importClasses.add(classDoc.qualifiedName()); // Model
+				// Implementation
 				importClasses.add(getPackageName(classDoc).replaceAll("org.jiemamy.model",
 						"org.jiemamy.internal.accessor")
-						+ "." + modelClassName + "Accessor"); // Model Implementation
+						+ "." + modelClassName + "Accessor"); // Model
+				// Implementation
 			}
 			for (CollectionProperty property : properties) {
 				addImportClasses(importClasses, property.getObservableCollectionClassName());
@@ -238,7 +249,7 @@
 			// ChangeSupportImplの生成
 			velocityContext.put("package", packageName);
 			modelClassInfos.add(new ModelClassInfo(classDoc.qualifiedName(), packageName + "." + modelClassName
-					+ "ChangeSupportImpl"));
+					+ "ChangeSupportImpl", Identifiable.class.isAssignableFrom(clazz)));
 			Collections.sort(importClasses);
 			Template template = Velocity.getTemplate("ChangeSupportImpl.vm");
 			File file = new File(dir.getAbsolutePath() + "/" + modelClassName + "ChangeSupportImpl.java");

Modified: sandbox/org.jiemamy.core.eventcodegen/trunk/org.jiemamy.core.eventcodegen/src/main/java/org/jiemamy/core/eventcodegen/ModelClassInfo.java
===================================================================
--- sandbox/org.jiemamy.core.eventcodegen/trunk/org.jiemamy.core.eventcodegen/src/main/java/org/jiemamy/core/eventcodegen/ModelClassInfo.java	2008-12-08 14:53:17 UTC (rev 2223)
+++ sandbox/org.jiemamy.core.eventcodegen/trunk/org.jiemamy.core.eventcodegen/src/main/java/org/jiemamy/core/eventcodegen/ModelClassInfo.java	2008-12-08 15:28:13 UTC (rev 2224)
@@ -1,13 +1,22 @@
 package org.jiemamy.core.eventcodegen;
 
+import org.jiemamy.model.Identifiable;
 
 public class ModelClassInfo {
 
+	/**
+	 * {@link Identifiable}を実装しているか。
+	 * diconのcomponent登録の定義を自動生成する際に
+	 * &lt;arg&gt;uuid&lt;/arg&gt;を追加するかどうかの判断に必要。
+	 */
+	boolean isIdentifiable;
+
 	String modelClassName;
 
 	String changeSupportClassName;
 
-	public ModelClassInfo(String modelClassName, String changeSupportClassName) {
+	public ModelClassInfo(String modelClassName, String changeSupportClassName, boolean isIdentifiable) {
+		this.isIdentifiable = isIdentifiable;
 		this.modelClassName = modelClassName;
 		this.changeSupportClassName = changeSupportClassName;
 	}
@@ -27,4 +36,12 @@
 	public void setChangeSupportClassName(String changeSupportClassName) {
 		this.changeSupportClassName = changeSupportClassName;
 	}
+
+	public boolean isIdentifiable() {
+		return isIdentifiable;
+	}
+
+	public void setIdentifiable(boolean isIdentifiable) {
+		this.isIdentifiable = isIdentifiable;
+	}
 }

Modified: sandbox/org.jiemamy.core.eventcodegen/trunk/org.jiemamy.core.eventcodegen/src/main/resources/jiemamy-event.dicon.vm
===================================================================
--- sandbox/org.jiemamy.core.eventcodegen/trunk/org.jiemamy.core.eventcodegen/src/main/resources/jiemamy-event.dicon.vm	2008-12-08 14:53:17 UTC (rev 2223)
+++ sandbox/org.jiemamy.core.eventcodegen/trunk/org.jiemamy.core.eventcodegen/src/main/resources/jiemamy-event.dicon.vm	2008-12-08 15:28:13 UTC (rev 2224)
@@ -24,7 +24,9 @@
 #foreach($modelClassInfo in $modelClassInfos)
 	<component class="$modelClassInfo.modelClassName" instance="prototype" autoBinding="none">
 		<aspect pointcut="set.*">setterInterceptor</aspect>
+#if($modelClassInfo.isIdentifiable)
 		<arg>uuid</arg>
+#end
 		<initMethod name="registerAdapter">
 			<arg>observableImpl</arg>
 		</initMethod>


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