[Jiemamy-notify] commit [2062] refactor

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2008年 10月 29日 (水) 03:03:13 JST


Revision: 2062
          http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=jiemamy&view=rev&rev=2062
Author:   daisuke_m
Date:     2008-10-29 03:03:13 +0900 (Wed, 29 Oct 2008)

Log Message:
-----------
refactor

Modified Paths:
--------------
    artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/ModelWriter.java
    artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/XmlElement.java


-------------- next part --------------
Modified: artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/ModelWriter.java
===================================================================
--- artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/ModelWriter.java	2008-10-28 17:44:57 UTC (rev 2061)
+++ artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/ModelWriter.java	2008-10-28 18:03:13 UTC (rev 2062)
@@ -19,7 +19,6 @@
 package org.jiemamy.serializer;
 
 import java.io.StringWriter;
-import java.util.Collection;
 import java.util.Queue;
 import java.util.Stack;
 
@@ -128,11 +127,7 @@
 				element.setState(ElementState.PROGRESS);
 				xmlStack.push(element.next());
 			} else {
-				// FIXME ↓このif条件、複雑だよなー。なんとかならんのか。
-				// nullか、空コレクションの時、と言いたいだけなのだが。
-				if (element.getContent() == null
-						|| (element.getContent() instanceof Collection && ((Collection<?>) element.getContent())
-							.isEmpty())) {
+				if (element.getContent() == null || element.isEmptyCollection()) {
 					dataWriter.emptyElement(NAMESPACE, element.getName(), "", element.getAttributes());
 				} else {
 					dataWriter.dataElement(NAMESPACE, element.getName(), element.getContent().toString());

Modified: artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/XmlElement.java
===================================================================
--- artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/XmlElement.java	2008-10-28 17:44:57 UTC (rev 2061)
+++ artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/XmlElement.java	2008-10-28 18:03:13 UTC (rev 2062)
@@ -181,6 +181,14 @@
 	}
 	
 	/**
+	 * TODO for daisuke
+	 * @return
+	 */
+	public boolean isEmptyCollection() {
+		return content instanceof Collection && ((Collection<?>) getContent()).isEmpty();
+	}
+	
+	/**
 	 * {@inheritDoc}
 	 */
 	public XmlElement next() {
@@ -221,5 +229,4 @@
 	enum ElementState {
 		INIT, PROGRESS, FINISHED
 	}
-	
 }


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