svnno****@sourc*****
svnno****@sourc*****
2008年 11月 16日 (日) 03:42:07 JST
Revision: 2153 http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=jiemamy&view=rev&rev=2153 Author: daisuke_m Date: 2008-11-16 03:42:07 +0900 (Sun, 16 Nov 2008) Log Message: ----------- 自前で作っちゃったけどcommonsにあった処理を置き換え。 Modified Paths: -------------- artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/model/RootModelImpl.java artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/model/connection/AbstractConnectionModelImpl.java artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/model/node/TableModelImpl.java artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/utils/ValueCheckUtil.java artemis/trunk/org.jiemamy.core/src/test/java/org/jiemamy/core/utils/ValueCheckUtilTest.java vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/DiagramEditPartFactory.java Removed Paths: ------------- artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/core/ -------------- next part -------------- Modified: artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/model/RootModelImpl.java =================================================================== --- artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/model/RootModelImpl.java 2008-11-15 16:53:49 UTC (rev 2152) +++ artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/model/RootModelImpl.java 2008-11-15 18:42:07 UTC (rev 2153) @@ -21,6 +21,7 @@ import java.util.List; import org.apache.commons.collections15.list.UnmodifiableList; +import org.apache.commons.lang.Validate; import org.seasar.framework.container.annotation.tiger.Binding; import org.jiemamy.core.utils.ValueCheckUtil; @@ -91,7 +92,7 @@ */ @Override public void appendModel(JiemamyModel jiemamyModel) { - ValueCheckUtil.assertNotNull(jiemamyModel); + Validate.notNull(jiemamyModel); ValueCheckUtil.assertInitialized(jiemamyModel); // HACK なんとか、上手くできんのやろか。 boolean added = false; @@ -268,7 +269,7 @@ */ @Override public void removeModel(JiemamyModel jiemamyModel) { - ValueCheckUtil.assertNotNull(jiemamyModel); + Validate.notNull(jiemamyModel); // HACK なんとか、上手くできんのやろか。 boolean removed = false; for (JiemamyModelAppender<? super RootModel, ? super JiemamyModel> appender : appenders) { Modified: artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/model/connection/AbstractConnectionModelImpl.java =================================================================== --- artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/model/connection/AbstractConnectionModelImpl.java 2008-11-15 16:53:49 UTC (rev 2152) +++ artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/model/connection/AbstractConnectionModelImpl.java 2008-11-15 18:42:07 UTC (rev 2153) @@ -65,7 +65,7 @@ * {@inheritDoc} */ public void setSource(AbstractNodeModel source) { - ValueCheckUtil.assertNotNull(source); +// ValueCheckUtil.assertNotNull(source); ValueCheckUtil.assertInitialized(source); this.source = source; } @@ -74,7 +74,7 @@ * {@inheritDoc} */ public void setTarget(AbstractNodeModel target) { - ValueCheckUtil.assertNotNull(target); +// ValueCheckUtil.assertNotNull(target); ValueCheckUtil.assertInitialized(target); this.target = target; } Modified: artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/model/node/TableModelImpl.java =================================================================== --- artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/model/node/TableModelImpl.java 2008-11-15 16:53:49 UTC (rev 2152) +++ artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/model/node/TableModelImpl.java 2008-11-15 18:42:07 UTC (rev 2153) @@ -21,6 +21,7 @@ import java.util.List; import org.apache.commons.collections15.list.UnmodifiableList; +import org.apache.commons.lang.Validate; import org.seasar.framework.container.annotation.tiger.Binding; import org.jiemamy.core.model.JiemamyModelAppender; @@ -64,7 +65,7 @@ */ @Override public void appendModel(JiemamyModel jiemamyModel) { - ValueCheckUtil.assertNotNull(jiemamyModel); + Validate.notNull(jiemamyModel); ValueCheckUtil.assertInitialized(jiemamyModel); // HACK なんとか、上手くできんのやろか。 boolean added = false; @@ -180,7 +181,7 @@ */ @Override public void removeModel(JiemamyModel jiemamyModel) { - ValueCheckUtil.assertNotNull(jiemamyModel); + Validate.notNull(jiemamyModel); // HACK なんとか、上手くできんのやろか。 boolean removed = false; for (JiemamyModelAppender<? super TableModel, ? super JiemamyModel> appender : appenders) { Modified: artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/utils/ValueCheckUtil.java =================================================================== --- artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/utils/ValueCheckUtil.java 2008-11-15 16:53:49 UTC (rev 2152) +++ artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/utils/ValueCheckUtil.java 2008-11-15 18:42:07 UTC (rev 2153) @@ -34,24 +34,15 @@ * @throws NotInitializedException 与えられたモデルが未初期化だった場合 */ public static void assertInitialized(JiemamyModel jiemamyModel) { + if (jiemamyModel == null) { + return; + } if (jiemamyModel.isInitialized() == false) { throw new NotInitializedException(jiemamyModel); } } /** - * NULLチェックを行う。 - * - * @param obj 検査対象オブジェクト - * @throws NullPointerException 与えられた値が <code>null</code> だった場合 - */ - public static void assertNotNull(Object obj) { - if (obj == null) { - throw new NullPointerException(); - } - } - - /** * ユーティリティクラス。 * @category instance creation */ Modified: artemis/trunk/org.jiemamy.core/src/test/java/org/jiemamy/core/utils/ValueCheckUtilTest.java =================================================================== --- artemis/trunk/org.jiemamy.core/src/test/java/org/jiemamy/core/utils/ValueCheckUtilTest.java 2008-11-15 16:53:49 UTC (rev 2152) +++ artemis/trunk/org.jiemamy.core/src/test/java/org/jiemamy/core/utils/ValueCheckUtilTest.java 2008-11-15 18:42:07 UTC (rev 2153) @@ -34,22 +34,6 @@ public class ValueCheckUtilTest { /** - * nullチェックが行われる。 - * @throws Exception - */ - @Test - public void test01_nullチェックが行われる() throws Exception { - ValueCheckUtil.assertNotNull(new Object()); - - try { - ValueCheckUtil.assertNotNull(null); - fail(); - } catch (NullPointerException e) { - // success - } - } - - /** * 初期化チェックが行われる。 * @throws Exception */ Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/DiagramEditPartFactory.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/DiagramEditPartFactory.java 2008-11-15 16:53:49 UTC (rev 2152) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/DiagramEditPartFactory.java 2008-11-15 18:42:07 UTC (rev 2153) @@ -18,10 +18,10 @@ */ package org.jiemamy.eclipse.editor.editpart; +import org.apache.commons.lang.Validate; import org.eclipse.gef.EditPart; import org.eclipse.gef.EditPartFactory; -import org.jiemamy.core.utils.ValueCheckUtil; import org.jiemamy.eclipse.editor.editpart.diagram.ForeignKeyEditPart; import org.jiemamy.eclipse.editor.editpart.diagram.RootEditPart; import org.jiemamy.eclipse.editor.editpart.diagram.StickyEditPart; @@ -44,7 +44,7 @@ * {@inheritDoc} */ public EditPart createEditPart(EditPart context, Object model) { - ValueCheckUtil.assertNotNull(model); + Validate.notNull(model); EditPart part = null; if (model instanceof RootModel) {