svnno****@sourc*****
svnno****@sourc*****
2008年 10月 31日 (金) 00:28:37 JST
Revision: 2064 http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=jiemamy&view=rev&rev=2064 Author: daisuke_m Date: 2008-10-31 00:28:37 +0900 (Fri, 31 Oct 2008) Log Message: ----------- ConstraintSetModelをConstraintsModelにリネーム。そしてCollection<Constraint>ベースに変更。 Modified Paths: -------------- artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/model/ColumnModelImpl.java artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/model/DomainModelImpl.java artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/model/constraint/ConstraintUtil.java artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/impl/JiemamySerializerImpl.java artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/model/typedef/SerializeTypeDefModel.java zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/spec/accessor/ColumnModelAccessor.java zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/spec/accessor/DomainModelAccessor.java zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/spec/model/ColumnModel.java zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/spec/model/DomainModel.java Added Paths: ----------- artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/model/constraint/ConstraintsModelImpl.java artemis/trunk/org.jiemamy.core/src/test/java/org/jiemamy/core/model/typedef/constraint/ConstraintsModelTest.java artemis/trunk/org.jiemamy.event/src/main/java/org/jiemamy/event/model/constraint/ConstraintsModelChangeSupportImpl.java artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/model/typedef/constraint/SerializeConstraintsModel.java zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/spec/accessor/constraint/ConstraintsModelAccessor.java zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/spec/model/constraint/ConstraintsModel.java zeus/trunk/org.jiemamy.spec.event/src/main/java/org/jiemamy/spec/event/model/constraint/ConstraintsModelChangeListener.java zeus/trunk/org.jiemamy.spec.event/src/main/java/org/jiemamy/spec/event/model/constraint/ConstraintsModelChangeSupport.java Removed Paths: ------------- artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/model/constraint/ConstraintSetModelImpl.java artemis/trunk/org.jiemamy.core/src/test/java/org/jiemamy/core/model/typedef/constraint/ConstraintSetModelTest.java artemis/trunk/org.jiemamy.event/src/main/java/org/jiemamy/event/model/constraint/ConstraintSetModelChangeSupportImpl.java artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/model/typedef/constraint/SerializeConstraintSetModel.java zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/spec/accessor/constraint/ConstraintSetModelAccessor.java zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/spec/model/constraint/ConstraintSetModel.java zeus/trunk/org.jiemamy.spec.event/src/main/java/org/jiemamy/spec/event/model/constraint/ConstraintSetModelChangeListener.java zeus/trunk/org.jiemamy.spec.event/src/main/java/org/jiemamy/spec/event/model/constraint/ConstraintSetModelChangeSupport.java -------------- next part -------------- Modified: artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/model/ColumnModelImpl.java =================================================================== --- artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/model/ColumnModelImpl.java 2008-10-29 15:12:21 UTC (rev 2063) +++ artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/model/ColumnModelImpl.java 2008-10-30 15:28:37 UTC (rev 2064) @@ -18,13 +18,13 @@ */ package org.jiemamy.core.model; -import org.jiemamy.core.model.constraint.ConstraintSetModelImpl; +import org.jiemamy.core.model.constraint.ConstraintsModelImpl; import org.jiemamy.core.model.constraint.ConstraintUtil; import org.jiemamy.spec.accessor.ColumnModelAccessor; import org.jiemamy.spec.model.ColumnModel; import org.jiemamy.spec.model.DomainModel; import org.jiemamy.spec.model.constraint.Constraint; -import org.jiemamy.spec.model.constraint.ConstraintSetModel; +import org.jiemamy.spec.model.constraint.ConstraintsModel; import org.jiemamy.spec.model.datatype.DataType; /** @@ -48,7 +48,7 @@ private String defaultValue; /** 制約 */ - private ConstraintSetModel constraints = new ConstraintSetModelImpl(); + private ConstraintsModel constraints = new ConstraintsModelImpl(); /** 単純インデックスの有無 */ private boolean simpleIndex; @@ -100,7 +100,7 @@ /** * {@inheritDoc} */ - public ConstraintSetModel getConstraints() { + public ConstraintsModel getConstraints() { if (dataType instanceof DomainModel) { DomainModel domainModel = (DomainModel) dataType; return ConstraintUtil.marge(constraints, domainModel.getConstraint()); @@ -208,7 +208,7 @@ * 制約を設定する。 * @param constraints 制約 */ - public void setConstraints(ConstraintSetModel constraints) { + public void setConstraints(ConstraintsModel constraints) { this.constraints = constraints; } Modified: artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/model/DomainModelImpl.java =================================================================== --- artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/model/DomainModelImpl.java 2008-10-29 15:12:21 UTC (rev 2063) +++ artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/model/DomainModelImpl.java 2008-10-30 15:28:37 UTC (rev 2064) @@ -18,11 +18,11 @@ */ package org.jiemamy.core.model; -import org.jiemamy.core.model.constraint.ConstraintSetModelImpl; +import org.jiemamy.core.model.constraint.ConstraintsModelImpl; import org.jiemamy.spec.accessor.DomainModelAccessor; import org.jiemamy.spec.model.DomainModel; import org.jiemamy.spec.model.constraint.Constraint; -import org.jiemamy.spec.model.constraint.ConstraintSetModel; +import org.jiemamy.spec.model.constraint.ConstraintsModel; import org.jiemamy.spec.model.datatype.DataType; /** @@ -46,7 +46,7 @@ private String defaultValue; /** 制約 */ - private ConstraintSetModel constraints = new ConstraintSetModelImpl(); + private ConstraintsModel constraints = new ConstraintsModelImpl(); /** 単純インデックスの有無 */ private boolean simpleIndex; @@ -95,7 +95,7 @@ /** * {@inheritDoc} */ - public ConstraintSetModel getConstraint() { + public ConstraintsModel getConstraint() { return constraints; } @@ -103,7 +103,7 @@ * 制約を取得する。 * @return 制約 */ - public ConstraintSetModel getConstraints() { + public ConstraintsModel getConstraints() { return constraints; } @@ -192,7 +192,7 @@ * 制約を設定する。 * @param constraints 制約 */ - public void setConstraints(ConstraintSetModel constraints) { + public void setConstraints(ConstraintsModel constraints) { this.constraints = constraints; } Deleted: artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/model/constraint/ConstraintSetModelImpl.java =================================================================== --- artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/model/constraint/ConstraintSetModelImpl.java 2008-10-29 15:12:21 UTC (rev 2063) +++ artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/model/constraint/ConstraintSetModelImpl.java 2008-10-30 15:28:37 UTC (rev 2064) @@ -1,128 +0,0 @@ -/* - * Copyright 2007-2008 MIYAMOTO Daisuke, jiemamy.org and the Others. - * Created on 2008/06/29 - * - * This file is part of Jiemamy. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, - * either express or implied. See the License for the specific language - * governing permissions and limitations under the License. - */ -package org.jiemamy.core.model.constraint; - -import java.util.Collection; -import java.util.Map; - -import org.apache.commons.lang.ClassUtils; -import org.seasar.framework.util.tiger.CollectionsUtil; - -import org.jiemamy.core.model.AbstractModel; -import org.jiemamy.spec.accessor.constraint.ConstraintSetModelAccessor; -import org.jiemamy.spec.model.constraint.Constraint; -import org.jiemamy.spec.model.constraint.ConstraintSetModel; - -/** - * チェック制約モデル。 - * - * @author daisuke - */ - @ SuppressWarnings("serial") -public class ConstraintSetModelImpl extends AbstractModel implements ConstraintSetModel, ConstraintSetModelAccessor { - - /** 制約のマップ */ - private Map<Class<? extends Constraint>, Constraint> constraintMap = CollectionsUtil.newHashMap(); - - - /** - * コンストラクタ。 - * @category instance creation - */ - public ConstraintSetModelImpl() { - initialize(); - } - - /** - * コンストラクタ。 - * @param constraints 制約 - * @category instance creation - */ - public ConstraintSetModelImpl(Constraint... constraints) { - initialize(); - for (Constraint constraint : constraints) { - constraintMap.put(constraint.getClass(), constraint); - } - } - - /** - * {@inheritDoc} - */ - public void add(Constraint constraint) { - constraintMap.put(constraint.getClass(), constraint); - } - - /** - * {@inheritDoc} - */ - public Map<Class<? extends Constraint>, Constraint> getConstraintMap() { - return constraintMap; - } - - /** - * {@inheritDoc} - */ - public Collection<Constraint> getConstraints() { - return constraintMap.values(); - } - - /** - * {@inheritDoc} - */ - public boolean has(Class<? extends Constraint> constraintClass) { - for (Map.Entry<Class<? extends Constraint>, Constraint> e : constraintMap.entrySet()) { - if (constraintClass.isAssignableFrom(e.getValue().getClass())) { - return true; - } - } - return false; - } - - /** - * {@inheritDoc} - */ - public void remove(Class<? extends Constraint> constraintClass) { - constraintMap.remove(constraintClass); - } - - /** - * {@inheritDoc} - */ - public void setConstraintMap(Map<Class<? extends Constraint>, Constraint> constraintMap) { - this.constraintMap = constraintMap; - } - - /** - * {@inheritDoc} - */ - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append(super.toString()); - sb.append("["); - for (Constraint constraint : constraintMap.values()) { - sb.append(ClassUtils.getShortClassName(constraint.getClass())); - sb.append(":"); - sb.append(constraint.getName()); - sb.append(", "); - } - sb.append("]"); - return sb.toString(); - } -} Modified: artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/model/constraint/ConstraintUtil.java =================================================================== --- artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/model/constraint/ConstraintUtil.java 2008-10-29 15:12:21 UTC (rev 2063) +++ artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/model/constraint/ConstraintUtil.java 2008-10-30 15:28:37 UTC (rev 2064) @@ -19,7 +19,7 @@ package org.jiemamy.core.model.constraint; import org.jiemamy.spec.model.constraint.Constraint; -import org.jiemamy.spec.model.constraint.ConstraintSetModel; +import org.jiemamy.spec.model.constraint.ConstraintsModel; /** * 制約モデル用ユーティリティクラス。 @@ -33,8 +33,8 @@ * @param b * @return マージされた制約 */ - public static ConstraintSetModel marge(ConstraintSetModel a, ConstraintSetModel b) { - ConstraintSetModel constraints = new ConstraintSetModelImpl(); + public static ConstraintsModel marge(ConstraintsModel a, ConstraintsModel b) { + ConstraintsModel constraints = new ConstraintsModelImpl(); for (Constraint constraint : a.getConstraints()) { constraints.add(constraint); } Copied: artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/model/constraint/ConstraintsModelImpl.java (from rev 2060, artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/model/constraint/ConstraintSetModelImpl.java) =================================================================== --- artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/model/constraint/ConstraintsModelImpl.java (rev 0) +++ artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/model/constraint/ConstraintsModelImpl.java 2008-10-30 15:28:37 UTC (rev 2064) @@ -0,0 +1,237 @@ +/* + * Copyright 2007-2008 MIYAMOTO Daisuke, jiemamy.org and the Others. + * Created on 2008/06/29 + * + * This file is part of Jiemamy. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package org.jiemamy.core.model.constraint; + +import java.util.Collection; +import java.util.Iterator; +import java.util.Map; + +import org.apache.commons.lang.ClassUtils; +import org.seasar.framework.util.tiger.CollectionsUtil; + +import org.jiemamy.core.model.AbstractModel; +import org.jiemamy.spec.accessor.constraint.ConstraintsModelAccessor; +import org.jiemamy.spec.model.constraint.Constraint; +import org.jiemamy.spec.model.constraint.ConstraintsModel; + +/** + * 制約の集合モデル。 + * + * @author daisuke + */ + @ SuppressWarnings("serial") +public class ConstraintsModelImpl extends AbstractModel implements ConstraintsModel, ConstraintsModelAccessor { + + /** 制約のマップ */ + private Map<Class<? extends Constraint>, Constraint> constraintMap = CollectionsUtil.newHashMap(); + + + /** + * コンストラクタ。 + * @category instance creation + */ + public ConstraintsModelImpl() { + initialize(); + } + + /** + * コンストラクタ。 + * @param constraints 制約 + * @category instance creation + */ + public ConstraintsModelImpl(Constraint... constraints) { + this(); + for (Constraint constraint : constraints) { + constraintMap.put(constraint.getClass(), constraint); + } + } + + /** + * {@inheritDoc} + */ + public boolean add(Constraint constraint) { + return constraintMap.put(constraint.getClass(), constraint) != null; + } + + /** + * {@inheritDoc} + */ + public boolean addAll(Collection<? extends Constraint> constraints) { + boolean modified = false; + for (Constraint constraint : constraints) { + if (add(constraint)) { + modified = true; + } + } + return modified; + } + + /** + * {@inheritDoc} + */ + public void clear() { + constraintMap.clear(); + } + + /** + * {@inheritDoc} + */ + public boolean contains(Object o) { + return constraintMap.get(o) != null; + } + + /** + * {@inheritDoc} + */ + public boolean containsAll(Collection<?> c) { + for (Object o : c) { + if (contains(o) == false) { + return false; + } + } + return true; + } + + /** + * {@inheritDoc} + */ + public Map<Class<? extends Constraint>, Constraint> getConstraintMap() { + return constraintMap; + } + + /** + * {@inheritDoc} + */ + public Collection<Constraint> getConstraints() { + return constraintMap.values(); + } + + /** + * {@inheritDoc} + */ + public boolean has(Class<? extends Constraint> constraintClass) { + for (Map.Entry<Class<? extends Constraint>, Constraint> e : constraintMap.entrySet()) { + if (constraintClass.isAssignableFrom(e.getValue().getClass())) { + return true; + } + } + return false; + } + + /** + * {@inheritDoc} + */ + public boolean isEmpty() { + return constraintMap.isEmpty(); + } + + /** + * {@inheritDoc} + */ + public Iterator<Constraint> iterator() { + return constraintMap.values().iterator(); + } + + /** + * {@inheritDoc} + */ + public boolean remove(Object o) { + Object target = o instanceof Class<?> ? o : o.getClass(); + return constraintMap.remove(target) != null; + } + + /** + * {@inheritDoc} + */ + public boolean removeAll(Collection<?> c) { + throw new UnsupportedOperationException(); + } + + /** + * {@inheritDoc} + */ + public boolean retainAll(Collection<?> c) { + throw new UnsupportedOperationException(); + } + + /** + * {@inheritDoc} + */ + public void setConstraintMap(Map<Class<? extends Constraint>, Constraint> constraintMap) { + this.constraintMap = constraintMap; + } + + /** + * {@inheritDoc} + */ + public int size() { + return constraintMap.size(); + } + + /** + * {@inheritDoc} + */ + public Object[] toArray() { + Object[] result = new Object[size()]; + Iterator<Constraint> e = iterator(); + for (int i = 0; e.hasNext(); i++) { + result[i] = e.next(); + } + return result; + } + + /** + * {@inheritDoc} + */ + @SuppressWarnings("unchecked") + public <T>T[] toArray(T[] a) { + int size = size(); + if (a.length < size) { + a = (T[]) java.lang.reflect.Array.newInstance(a.getClass().getComponentType(), size); + } + + Iterator<Constraint> it = iterator(); + Object[] result = a; + for (int i = 0; i < size; i++) { + result[i] = it.next(); + } + if (a.length > size) { + a[size] = null; + } + return a; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append(super.toString()); + sb.append("["); + for (Constraint constraint : constraintMap.values()) { + sb.append(ClassUtils.getShortClassName(constraint.getClass())); + sb.append(":"); + sb.append(constraint.getName()); + sb.append(", "); + } + sb.append("]"); + return sb.toString(); + } +} Property changes on: artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/model/constraint/ConstraintsModelImpl.java ___________________________________________________________________ Name: svn:mime-type + text/plain Deleted: artemis/trunk/org.jiemamy.core/src/test/java/org/jiemamy/core/model/typedef/constraint/ConstraintSetModelTest.java =================================================================== --- artemis/trunk/org.jiemamy.core/src/test/java/org/jiemamy/core/model/typedef/constraint/ConstraintSetModelTest.java 2008-10-29 15:12:21 UTC (rev 2063) +++ artemis/trunk/org.jiemamy.core/src/test/java/org/jiemamy/core/model/typedef/constraint/ConstraintSetModelTest.java 2008-10-30 15:28:37 UTC (rev 2064) @@ -1,164 +0,0 @@ -/* - * Copyright 2007-2008 MIYAMOTO Daisuke, jiemamy.org and the Others. - * Created on 2008/06/22 - * - * This file is part of Jiemamy-core. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, - * either express or implied. See the License for the specific language - * governing permissions and limitations under the License. - */ -package org.jiemamy.core.model.typedef.constraint; - -import static org.hamcrest.CoreMatchers.is; -import static org.junit.Assert.assertThat; - -import java.util.Map; - -import junitx.util.PrivateAccessor; - -import org.junit.Test; -import org.seasar.framework.util.tiger.CollectionsUtil; - -import org.jiemamy.core.model.AbstractModel; -import org.jiemamy.core.model.constraint.ConstraintSetModelImpl; -import org.jiemamy.spec.model.constraint.Constraint; -import org.jiemamy.spec.model.constraint.ConstraintSetModel; - -/** - * {@link ConstraintSetModelImpl}のテストクラス。 - * サンプルなので、とりあえず英語。 - * - * @author ykhr - */ -public class ConstraintSetModelTest { - - private ConstraintSetModel model = new ConstraintSetModelImpl(); - - - /** - * Addしたものが管理されていること(まじめバージョン) - * @throws Exception - */ - @Test - @SuppressWarnings("unchecked") - public void testAdd01_1() throws Exception { - MockConstraint mock = new MockConstraint(); - - model.add(mock); - - Map<Class<? extends Constraint>, Constraint> map = - (Map<Class<? extends Constraint>, Constraint>) PrivateAccessor.getField(model, "constraintMap"); - assertThat(map.containsValue(mock), is(true)); - } - - /** - * Addしたものが管理されていること(めんどくさがりバージョン) - * @throws Exception - */ - @Test - public void testAdd01_2() throws Exception { - MockConstraint mock = new MockConstraint(); - - model.add(mock); - - assertThat(model.has(MockConstraint.class), is(true)); - } - - /** - * 保持していないConstraintは、hasメソッドがfalseとなること。 - * @throws Exception - */ - @Test - public void testHas01() throws Exception { - assertThat(model.has(MockConstraint.class), is(false)); - } - - /** - * 保持しているConstraintの場合、hasメソッドがtrueとなること。 - * testAdd01_2と一緒になったw - * @throws Exception - */ - @Test - public void testHas02() throws Exception { - MockConstraint mock = new MockConstraint(); - - model.add(mock); - - assertThat(model.has(MockConstraint.class), is(true)); - } - - /** - * 保持してるConstraintをremoveすると、保持しなくなること(まじめバージョン) - * @throws Exception - */ - @Test - @SuppressWarnings("unchecked") - public void testRemove01_1() throws Exception { - Map<Class<? extends Constraint>, Constraint> constraints = CollectionsUtil.newHashMap(); - MockConstraint mock = new MockConstraint(); - constraints.put(mock.getClass(), mock); - PrivateAccessor.setField(model, "constraintMap", constraints); - - model.remove(MockConstraint.class); - - Map<Class<? extends Constraint>, Constraint> map = - (Map<Class<? extends Constraint>, Constraint>) PrivateAccessor.getField(model, "constraintMap"); - assertThat(map.containsValue(mock), is(false)); - } - - /** - * 保持してるConstraintをremoveすると、保持しなくなること(めんどくさがりバージョン) - * @throws Exception - */ - @Test - public void testRemove01_2() throws Exception { - MockConstraint mock = new MockConstraint(); - model.add(mock); - - model.remove(MockConstraint.class); - - assertThat(model.has(MockConstraint.class), is(false)); - } - - /** - * はじめから保持していなものをremoveしても、なにもないこと。 - * @throws Exception - */ - @Test - public void testRemove02() throws Exception { - model.remove(MockConstraint.class); - assertThat(model.has(MockConstraint.class), is(false)); - } - - - /** - * 制約モデルのモック - * @author ykhr - */ - @SuppressWarnings("serial") - private static class MockConstraint extends AbstractModel implements Constraint { - - /** - * {@inheritDoc} - */ - public String getName() { - return null; - } - - /** - * {@inheritDoc} - */ - public void setName(String name) { - } - } - -} Copied: artemis/trunk/org.jiemamy.core/src/test/java/org/jiemamy/core/model/typedef/constraint/ConstraintsModelTest.java (from rev 2060, artemis/trunk/org.jiemamy.core/src/test/java/org/jiemamy/core/model/typedef/constraint/ConstraintSetModelTest.java) =================================================================== --- artemis/trunk/org.jiemamy.core/src/test/java/org/jiemamy/core/model/typedef/constraint/ConstraintsModelTest.java (rev 0) +++ artemis/trunk/org.jiemamy.core/src/test/java/org/jiemamy/core/model/typedef/constraint/ConstraintsModelTest.java 2008-10-30 15:28:37 UTC (rev 2064) @@ -0,0 +1,164 @@ +/* + * Copyright 2007-2008 MIYAMOTO Daisuke, jiemamy.org and the Others. + * Created on 2008/06/22 + * + * This file is part of Jiemamy-core. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package org.jiemamy.core.model.typedef.constraint; + +import static org.hamcrest.CoreMatchers.is; +import static org.junit.Assert.assertThat; + +import java.util.Map; + +import junitx.util.PrivateAccessor; + +import org.junit.Test; +import org.seasar.framework.util.tiger.CollectionsUtil; + +import org.jiemamy.core.model.AbstractModel; +import org.jiemamy.core.model.constraint.ConstraintsModelImpl; +import org.jiemamy.spec.model.constraint.Constraint; +import org.jiemamy.spec.model.constraint.ConstraintsModel; + +/** + * {@link ConstraintsModelImpl}のテストクラス。 + * サンプルなので、とりあえず英語。 + * + * @author ykhr + */ +public class ConstraintsModelTest { + + private ConstraintsModel model = new ConstraintsModelImpl(); + + + /** + * Addしたものが管理されていること(まじめバージョン) + * @throws Exception + */ + @Test + @SuppressWarnings("unchecked") + public void testAdd01_1() throws Exception { + MockConstraint mock = new MockConstraint(); + + model.add(mock); + + Map<Class<? extends Constraint>, Constraint> map = + (Map<Class<? extends Constraint>, Constraint>) PrivateAccessor.getField(model, "constraintMap"); + assertThat(map.containsValue(mock), is(true)); + } + + /** + * Addしたものが管理されていること(めんどくさがりバージョン) + * @throws Exception + */ + @Test + public void testAdd01_2() throws Exception { + MockConstraint mock = new MockConstraint(); + + model.add(mock); + + assertThat(model.has(MockConstraint.class), is(true)); + } + + /** + * 保持していないConstraintは、hasメソッドがfalseとなること。 + * @throws Exception + */ + @Test + public void testHas01() throws Exception { + assertThat(model.has(MockConstraint.class), is(false)); + } + + /** + * 保持しているConstraintの場合、hasメソッドがtrueとなること。 + * testAdd01_2と一緒になったw + * @throws Exception + */ + @Test + public void testHas02() throws Exception { + MockConstraint mock = new MockConstraint(); + + model.add(mock); + + assertThat(model.has(MockConstraint.class), is(true)); + } + + /** + * 保持してるConstraintをremoveすると、保持しなくなること(まじめバージョン) + * @throws Exception + */ + @Test + @SuppressWarnings("unchecked") + public void testRemove01_1() throws Exception { + Map<Class<? extends Constraint>, Constraint> constraints = CollectionsUtil.newHashMap(); + MockConstraint mock = new MockConstraint(); + constraints.put(mock.getClass(), mock); + PrivateAccessor.setField(model, "constraintMap", constraints); + + model.remove(MockConstraint.class); + + Map<Class<? extends Constraint>, Constraint> map = + (Map<Class<? extends Constraint>, Constraint>) PrivateAccessor.getField(model, "constraintMap"); + assertThat(map.containsValue(mock), is(false)); + } + + /** + * 保持してるConstraintをremoveすると、保持しなくなること(めんどくさがりバージョン) + * @throws Exception + */ + @Test + public void testRemove01_2() throws Exception { + MockConstraint mock = new MockConstraint(); + model.add(mock); + + model.remove(MockConstraint.class); + + assertThat(model.has(MockConstraint.class), is(false)); + } + + /** + * はじめから保持していなものをremoveしても、なにもないこと。 + * @throws Exception + */ + @Test + public void testRemove02() throws Exception { + model.remove(MockConstraint.class); + assertThat(model.has(MockConstraint.class), is(false)); + } + + + /** + * 制約モデルのモック + * @author ykhr + */ + @SuppressWarnings("serial") + private static class MockConstraint extends AbstractModel implements Constraint { + + /** + * {@inheritDoc} + */ + public String getName() { + return null; + } + + /** + * {@inheritDoc} + */ + public void setName(String name) { + } + } + +} Property changes on: artemis/trunk/org.jiemamy.core/src/test/java/org/jiemamy/core/model/typedef/constraint/ConstraintsModelTest.java ___________________________________________________________________ Name: svn:mime-type + text/plain Deleted: artemis/trunk/org.jiemamy.event/src/main/java/org/jiemamy/event/model/constraint/ConstraintSetModelChangeSupportImpl.java =================================================================== --- artemis/trunk/org.jiemamy.event/src/main/java/org/jiemamy/event/model/constraint/ConstraintSetModelChangeSupportImpl.java 2008-10-29 15:12:21 UTC (rev 2063) +++ artemis/trunk/org.jiemamy.event/src/main/java/org/jiemamy/event/model/constraint/ConstraintSetModelChangeSupportImpl.java 2008-10-30 15:28:37 UTC (rev 2064) @@ -1,57 +0,0 @@ -/* - * Copyright 2007-2008 MIYAMOTO Daisuke, jiemamy.org and the Others. Created on 2008/07/02 - * - * This file is part of Jiemamy. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.jiemamy.event.model.constraint; - -import org.jiemamy.event.AbstractModelChangeSupport; -import org.jiemamy.spec.event.ModelChangeEvent; -import org.jiemamy.spec.event.ModelChangeListener; -import org.jiemamy.spec.event.ModelChangeSupport; -import org.jiemamy.spec.event.Observable; -import org.jiemamy.spec.model.constraint.ConstraintSetModel; - -/** - * Event関連の処理をModel内に直接記述するとModelのSourceの可読性が低くなるため、ConstraintSetModelからそれらを引き受ける。 - * - * @author shin1ogawa - */ -public class ConstraintSetModelChangeSupportImpl extends AbstractModelChangeSupport implements ModelChangeSupport { - - /** - * ConstraintSetModelの属性の変更Eventを処理するListener - * - * @see #fireModelChange(ModelChangeEvent) - */ - private ModelChangeListener modelChangeListener = new ModelChangeListener() { - - /** - * {@inheritDoc} - */ - public void modelChanged(ModelChangeEvent event) { - fireModelChange(event); - } - }; - - - /** - * コンストラクタ。 - * - * @param source {@link ConstraintSetModel} - * @category instance creation - */ - public ConstraintSetModelChangeSupportImpl(ConstraintSetModel source) { - source.getAdapter(Observable.class).addModelChangeListener(modelChangeListener); - } - -} Copied: artemis/trunk/org.jiemamy.event/src/main/java/org/jiemamy/event/model/constraint/ConstraintsModelChangeSupportImpl.java (from rev 2060, artemis/trunk/org.jiemamy.event/src/main/java/org/jiemamy/event/model/constraint/ConstraintSetModelChangeSupportImpl.java) =================================================================== --- artemis/trunk/org.jiemamy.event/src/main/java/org/jiemamy/event/model/constraint/ConstraintsModelChangeSupportImpl.java (rev 0) +++ artemis/trunk/org.jiemamy.event/src/main/java/org/jiemamy/event/model/constraint/ConstraintsModelChangeSupportImpl.java 2008-10-30 15:28:37 UTC (rev 2064) @@ -0,0 +1,57 @@ +/* + * Copyright 2007-2008 MIYAMOTO Daisuke, jiemamy.org and the Others. Created on 2008/07/02 + * + * This file is part of Jiemamy. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.jiemamy.event.model.constraint; + +import org.jiemamy.event.AbstractModelChangeSupport; +import org.jiemamy.spec.event.ModelChangeEvent; +import org.jiemamy.spec.event.ModelChangeListener; +import org.jiemamy.spec.event.ModelChangeSupport; +import org.jiemamy.spec.event.Observable; +import org.jiemamy.spec.model.constraint.ConstraintsModel; + +/** + * Event関連の処理をModel内に直接記述するとModelのSourceの可読性が低くなるため、ConstraintSetModelからそれらを引き受ける。 + * + * @author shin1ogawa + */ +public class ConstraintsModelChangeSupportImpl extends AbstractModelChangeSupport implements ModelChangeSupport { + + /** + * ConstraintSetModelの属性の変更Eventを処理するListener + * + * @see #fireModelChange(ModelChangeEvent) + */ + private ModelChangeListener modelChangeListener = new ModelChangeListener() { + + /** + * {@inheritDoc} + */ + public void modelChanged(ModelChangeEvent event) { + fireModelChange(event); + } + }; + + + /** + * コンストラクタ。 + * + * @param source {@link ConstraintsModel} + * @category instance creation + */ + public ConstraintsModelChangeSupportImpl(ConstraintsModel source) { + source.getAdapter(Observable.class).addModelChangeListener(modelChangeListener); + } + +} Property changes on: artemis/trunk/org.jiemamy.event/src/main/java/org/jiemamy/event/model/constraint/ConstraintsModelChangeSupportImpl.java ___________________________________________________________________ Name: svn:mime-type + text/plain Modified: artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/impl/JiemamySerializerImpl.java =================================================================== --- artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/impl/JiemamySerializerImpl.java 2008-10-29 15:12:21 UTC (rev 2063) +++ artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/impl/JiemamySerializerImpl.java 2008-10-30 15:28:37 UTC (rev 2064) @@ -47,7 +47,7 @@ import org.jiemamy.serializer.model.typedef.SerializeInheritanceColumnModel; import org.jiemamy.serializer.model.typedef.SerializeTypeDefModel; import org.jiemamy.serializer.model.typedef.constraint.SerializeCheckConstraintModel; -import org.jiemamy.serializer.model.typedef.constraint.SerializeConstraintSetModel; +import org.jiemamy.serializer.model.typedef.constraint.SerializeConstraintsModel; import org.jiemamy.serializer.model.typedef.constraint.SerializeNotNullConstraintModel; import org.jiemamy.serializer.model.typedef.constraint.SerializePrimaryKeyConstraintModel; import org.jiemamy.serializer.model.typedef.constraint.SerializeUniqueConstraintModel; @@ -125,7 +125,7 @@ xstream.processAnnotations(SerializeInheritanceColumnModel.class); xstream.processAnnotations(SerializeTypeDefModel.class); xstream.processAnnotations(SerializeCheckConstraintModel.class); - xstream.processAnnotations(SerializeConstraintSetModel.class); + xstream.processAnnotations(SerializeConstraintsModel.class); xstream.processAnnotations(SerializeNotNullConstraintModel.class); xstream.processAnnotations(SerializePrimaryKeyConstraintModel.class); xstream.processAnnotations(SerializeUniqueConstraintModel.class); Modified: artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/model/typedef/SerializeTypeDefModel.java =================================================================== --- artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/model/typedef/SerializeTypeDefModel.java 2008-10-29 15:12:21 UTC (rev 2063) +++ artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/model/typedef/SerializeTypeDefModel.java 2008-10-30 15:28:37 UTC (rev 2064) @@ -21,7 +21,7 @@ import com.thoughtworks.xstream.annotations.XStreamAsAttribute; import org.jiemamy.serializer.model.AbstractSerializeModel; -import org.jiemamy.serializer.model.typedef.constraint.SerializeConstraintSetModel; +import org.jiemamy.serializer.model.typedef.constraint.SerializeConstraintsModel; import org.jiemamy.spec.model.datatype.DataType; /** @@ -50,7 +50,7 @@ private String defaultValue; /** 制約 */ - private SerializeConstraintSetModel constraints = new SerializeConstraintSetModel(); + private SerializeConstraintsModel constraints = new SerializeConstraintsModel(); /** 単純インデックスの有無 */ private boolean simpleIndex; @@ -66,7 +66,7 @@ * 制約を取得する。 * @return 制約 */ - public SerializeConstraintSetModel getConstraints() { + public SerializeConstraintsModel getConstraints() { return constraints; } @@ -138,7 +138,7 @@ * 制約を設定する。 * @param constraints 制約 */ - public void setConstraints(SerializeConstraintSetModel constraints) { + public void setConstraints(SerializeConstraintsModel constraints) { this.constraints = constraints; } Deleted: artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/model/typedef/constraint/SerializeConstraintSetModel.java =================================================================== --- artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/model/typedef/constraint/SerializeConstraintSetModel.java 2008-10-29 15:12:21 UTC (rev 2063) +++ artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/model/typedef/constraint/SerializeConstraintSetModel.java 2008-10-30 15:28:37 UTC (rev 2064) @@ -1,60 +0,0 @@ -/* - * Copyright 2007-2008 MIYAMOTO Daisuke, jiemamy.org and the Others. - * Created on 2008/06/21 - * - * This file is part of Jiemamy-core. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, - * either express or implied. See the License for the specific language - * governing permissions and limitations under the License. - */ -package org.jiemamy.serializer.model.typedef.constraint; - -import java.util.Set; - -import com.thoughtworks.xstream.annotations.XStreamAlias; - -import org.seasar.framework.util.tiger.CollectionsUtil; - -import org.jiemamy.serializer.model.AbstractSerializeModel; -import org.jiemamy.spec.model.constraint.Constraint; -import org.jiemamy.spec.model.constraint.ConstraintSetModel; - -/** - * {@link ConstraintSetModel}に対応するシリアライズ用のモデル。 - * - * @author j5ik2o - */ - @ XStreamAlias("constraintSetModel") - @ SuppressWarnings("serial") -public class SerializeConstraintSetModel extends AbstractSerializeModel { - - /** 制約のセット */ - private Set<Constraint> constraintSet = CollectionsUtil.newHashSet(); - - - /** - * 制約のセットを取得する。 - * @return 制約のセット - */ - public Set<Constraint> getConstraintSet() { - return constraintSet; - } - - /** - * 制約のセットを設定する。 - * @param constraintSet 制約のセット - */ - public void setConstraintSet(Set<Constraint> constraintSet) { - this.constraintSet = constraintSet; - } - -} Copied: artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/model/typedef/constraint/SerializeConstraintsModel.java (from rev 2060, artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/model/typedef/constraint/SerializeConstraintSetModel.java) =================================================================== --- artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/model/typedef/constraint/SerializeConstraintsModel.java (rev 0) +++ artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/model/typedef/constraint/SerializeConstraintsModel.java 2008-10-30 15:28:37 UTC (rev 2064) @@ -0,0 +1,60 @@ +/* + * Copyright 2007-2008 MIYAMOTO Daisuke, jiemamy.org and the Others. + * Created on 2008/06/21 + * + * This file is part of Jiemamy-core. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package org.jiemamy.serializer.model.typedef.constraint; + +import java.util.Set; + +import com.thoughtworks.xstream.annotations.XStreamAlias; + +import org.seasar.framework.util.tiger.CollectionsUtil; + +import org.jiemamy.serializer.model.AbstractSerializeModel; +import org.jiemamy.spec.model.constraint.Constraint; +import org.jiemamy.spec.model.constraint.ConstraintsModel; + +/** + * {@link ConstraintsModel}に対応するシリアライズ用のモデル。 + * + * @author j5ik2o + */ + @ XStreamAlias("constraintSetModel") + @ SuppressWarnings("serial") +public class SerializeConstraintsModel extends AbstractSerializeModel { + + /** 制約のセット */ + private Set<Constraint> constraintSet = CollectionsUtil.newHashSet(); + + + /** + * 制約のセットを取得する。 + * @return 制約のセット + */ + public Set<Constraint> getConstraintSet() { + return constraintSet; + } + + /** + * 制約のセットを設定する。 + * @param constraintSet 制約のセット + */ + public void setConstraintSet(Set<Constraint> constraintSet) { + this.constraintSet = constraintSet; + } + +} Modified: zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/spec/accessor/ColumnModelAccessor.java =================================================================== --- zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/spec/accessor/ColumnModelAccessor.java 2008-10-29 15:12:21 UTC (rev 2063) +++ zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/spec/accessor/ColumnModelAccessor.java 2008-10-30 15:28:37 UTC (rev 2064) @@ -18,7 +18,7 @@ */ package org.jiemamy.spec.accessor; -import org.jiemamy.spec.model.constraint.ConstraintSetModel; +import org.jiemamy.spec.model.constraint.ConstraintsModel; import org.jiemamy.spec.model.datatype.DataType; /** @@ -31,7 +31,7 @@ * 制約を取得する。 * @return 制約 */ - ConstraintSetModel getConstraints(); + ConstraintsModel getConstraints(); /** * 型を取得する。 @@ -85,7 +85,7 @@ * 制約を設定する。 * @param constraints 制約 */ - void setConstraints(ConstraintSetModel constraints); + void setConstraints(ConstraintsModel constraints); /** * 型を設定する。 Modified: zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/spec/accessor/DomainModelAccessor.java =================================================================== --- zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/spec/accessor/DomainModelAccessor.java 2008-10-29 15:12:21 UTC (rev 2063) +++ zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/spec/accessor/DomainModelAccessor.java 2008-10-30 15:28:37 UTC (rev 2064) @@ -18,7 +18,7 @@ */ package org.jiemamy.spec.accessor; -import org.jiemamy.spec.model.constraint.ConstraintSetModel; +import org.jiemamy.spec.model.constraint.ConstraintsModel; import org.jiemamy.spec.model.datatype.DataType; /** @@ -31,7 +31,7 @@ * 制約を取得する。 * @return 制約 */ - ConstraintSetModel getConstraints(); + ConstraintsModel getConstraints(); /** * ドメインとして定義された型を取得する。 @@ -79,7 +79,7 @@ * 制約を設定する。 * @param constraints 制約 */ - void setConstraints(ConstraintSetModel constraints); + void setConstraints(ConstraintsModel constraints); /** * ドメインとして定義された型を設定する。 Deleted: zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/spec/accessor/constraint/ConstraintSetModelAccessor.java =================================================================== --- zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/spec/accessor/constraint/ConstraintSetModelAccessor.java 2008-10-29 15:12:21 UTC (rev 2063) +++ zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/spec/accessor/constraint/ConstraintSetModelAccessor.java 2008-10-30 15:28:37 UTC (rev 2064) @@ -1,44 +0,0 @@ -/* - * Copyright 2007-2008 MIYAMOTO Daisuke, jiemamy.org and the Others. - * Created on 2008/10/25 - * - * This file is part of Jiemamy. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, - * either express or implied. See the License for the specific language - * governing permissions and limitations under the License. - */ -package org.jiemamy.spec.accessor.constraint; - -import java.util.Map; - -import org.jiemamy.spec.accessor.JiemamyModelAccessor; -import org.jiemamy.spec.model.constraint.Constraint; - -/** - * TODO for daisuke - * @author daisuke - */ -public interface ConstraintSetModelAccessor extends JiemamyModelAccessor { - - /** - * 制約のマップを取得する。 - * @return 制約のマップ - */ - Map<Class<? extends Constraint>, Constraint> getConstraintMap(); - - /** - * 制約のマップを設定する。 - * @param constraintMap 制約のマップ - */ - void setConstraintMap(Map<Class<? extends Constraint>, Constraint> constraintMap); - -} Copied: zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/spec/accessor/constraint/ConstraintsModelAccessor.java (from rev 2060, zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/spec/accessor/constraint/ConstraintSetModelAccessor.java) =================================================================== --- zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/spec/accessor/constraint/ConstraintsModelAccessor.java (rev 0) +++ zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/spec/accessor/constraint/ConstraintsModelAccessor.java 2008-10-30 15:28:37 UTC (rev 2064) @@ -0,0 +1,44 @@ +/* + * Copyright 2007-2008 MIYAMOTO Daisuke, jiemamy.org and the Others. + * Created on 2008/10/25 + * + * This file is part of Jiemamy. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package org.jiemamy.spec.accessor.constraint; + +import java.util.Map; + +import org.jiemamy.spec.accessor.JiemamyModelAccessor; +import org.jiemamy.spec.model.constraint.Constraint; + +/** + * TODO for daisuke + * @author daisuke + */ +public interface ConstraintsModelAccessor extends JiemamyModelAccessor { + + /** + * 制約のマップを取得する。 + * @return 制約のマップ + */ + Map<Class<? extends Constraint>, Constraint> getConstraintMap(); + + /** + * 制約のマップを設定する。 + * @param constraintMap 制約のマップ + */ + void setConstraintMap(Map<Class<? extends Constraint>, Constraint> constraintMap); + +} Property changes on: zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/spec/accessor/constraint/ConstraintsModelAccessor.java ___________________________________________________________________ Name: svn:mime-type + text/plain Modified: zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/spec/model/ColumnModel.java =================================================================== --- zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/spec/model/ColumnModel.java 2008-10-29 15:12:21 UTC (rev 2063) +++ zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/spec/model/ColumnModel.java 2008-10-30 15:28:37 UTC (rev 2064) @@ -19,7 +19,7 @@ package org.jiemamy.spec.model; import org.jiemamy.spec.model.constraint.Constraint; -import org.jiemamy.spec.model.constraint.ConstraintSetModel; +import org.jiemamy.spec.model.constraint.ConstraintsModel; import org.jiemamy.spec.model.datatype.DataType; /** @@ -38,7 +38,7 @@ * 制約を取得する。 * @return 制約 */ - ConstraintSetModel getConstraints(); + ConstraintsModel getConstraints(); /** * 型を取得する。 Modified: zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/spec/model/DomainModel.java =================================================================== --- zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/spec/model/DomainModel.java 2008-10-29 15:12:21 UTC (rev 2063) +++ zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/spec/model/DomainModel.java 2008-10-30 15:28:37 UTC (rev 2064) @@ -19,7 +19,7 @@ package org.jiemamy.spec.model; import org.jiemamy.spec.model.constraint.Constraint; -import org.jiemamy.spec.model.constraint.ConstraintSetModel; +import org.jiemamy.spec.model.constraint.ConstraintsModel; import org.jiemamy.spec.model.datatype.DataType; /** @@ -38,7 +38,7 @@ * 制約を取得する。 * @return 制約 */ - ConstraintSetModel getConstraint(); + ConstraintsModel getConstraint(); /** * ドメインとして定義された型を取得する。 Deleted: zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/spec/model/constraint/ConstraintSetModel.java =================================================================== --- zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/spec/model/constraint/ConstraintSetModel.java 2008-10-29 15:12:21 UTC (rev 2063) +++ zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/spec/model/constraint/ConstraintSetModel.java 2008-10-30 15:28:37 UTC (rev 2064) @@ -1,63 +0,0 @@ -/* - * Copyright 2007-2008 MIYAMOTO Daisuke, jiemamy.org and the Others. - * Created on 2008/09/17 - * - * This file is part of Jiemamy. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, - * either express or implied. See the License for the specific language - * governing permissions and limitations under the License. - */ -package org.jiemamy.spec.model.constraint; - -import java.util.Collection; -import java.util.Map; - -import org.jiemamy.spec.model.JiemamyModel; - -/** - * 制約の集合モデルインターフェイス。 - * @author daisuke - */ -public interface ConstraintSetModel extends JiemamyModel { - - /** - * 制約を追加する。 - * @param constraint 追加する制約 - */ - void add(Constraint constraint); - - /** - * 制約のセットを取得する。 - * @return 制約のセット - */ - Collection<Constraint> getConstraints(); - - /** - * 指定した制約があるかどうか調べる。 - * @param constraintClass 制約クラス - * @return 制約があれば<tt>true</tt> - */ - boolean has(Class<? extends Constraint> constraintClass); - - /** - * 制約を取り除く。 - * @param constraintClass 取り除く制約クラス - */ - void remove(Class<? extends Constraint> constraintClass); - - /** - * 制約を設定する。 - * @param constraintMap 制約のMap - */ - void setConstraintMap(Map<Class<? extends Constraint>, Constraint> constraintMap); - -} Copied: zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/spec/model/constraint/ConstraintsModel.java (from rev 2060, zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/spec/model/constraint/ConstraintSetModel.java) =================================================================== --- zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/spec/model/constraint/ConstraintsModel.java (rev 0) +++ zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/spec/model/constraint/ConstraintsModel.java 2008-10-30 15:28:37 UTC (rev 2064) @@ -0,0 +1,56 @@ +/* + * Copyright 2007-2008 MIYAMOTO Daisuke, jiemamy.org and the Others. + * Created on 2008/09/17 + * + * This file is part of Jiemamy. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package org.jiemamy.spec.model.constraint; + +import java.util.Collection; + +import org.jiemamy.spec.model.JiemamyModel; + +/** + * 制約の集合モデルインターフェイス。 + * @author daisuke + */ +public interface ConstraintsModel extends JiemamyModel, Collection<Constraint> { + + /** + * 制約を追加する。 + * @param constraint 追加する制約 + */ + boolean add(Constraint constraint); + + /** + * 制約のセットを取得する。 + * @return 制約のセット + */ + Collection<Constraint> getConstraints(); + + /** + * 指定した制約があるかどうか調べる。 + * @param constraintClass 制約クラス + * @return 制約があれば<tt>true</tt> + */ + boolean has(Class<? extends Constraint> constraintClass); + + /** + * 制約を取り除く。 + * @param constraintClass 取り除く制約クラス + */ + boolean remove(Object constraintClass); + +} Property changes on: zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/spec/model/constraint/ConstraintsModel.java ___________________________________________________________________ Name: svn:mime-type + text/plain Deleted: zeus/trunk/org.jiemamy.spec.event/src/main/java/org/jiemamy/spec/event/model/constraint/ConstraintSetModelChangeListener.java =================================================================== --- zeus/trunk/org.jiemamy.spec.event/src/main/java/org/jiemamy/spec/event/model/constraint/ConstraintSetModelChangeListener.java 2008-10-29 15:12:21 UTC (rev 2063) +++ zeus/trunk/org.jiemamy.spec.event/src/main/java/org/jiemamy/spec/event/model/constraint/ConstraintSetModelChangeListener.java 2008-10-30 15:28:37 UTC (rev 2064) @@ -1,27 +0,0 @@ -/* - * Copyright 2007-2008 MIYAMOTO Daisuke, jiemamy.org and the Others. Created on 2008/06/29 - * - * This file is part of Jiemamy. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.jiemamy.spec.event.model.constraint; - -import org.jiemamy.spec.event.ModelChangeListener; - -/** - * ConstraintSetModel用のListener。 - * 近々削除されます! - * @author shin1ogawa - */ - @ Deprecated -public interface ConstraintSetModelChangeListener extends ModelChangeListener { - -} Deleted: zeus/trunk/org.jiemamy.spec.event/src/main/java/org/jiemamy/spec/event/model/constraint/ConstraintSetModelChangeSupport.java =================================================================== --- zeus/trunk/org.jiemamy.spec.event/src/main/java/org/jiemamy/spec/event/model/constraint/ConstraintSetModelChangeSupport.java 2008-10-29 15:12:21 UTC (rev 2063) +++ zeus/trunk/org.jiemamy.spec.event/src/main/java/org/jiemamy/spec/event/model/constraint/ConstraintSetModelChangeSupport.java 2008-10-30 15:28:37 UTC (rev 2064) @@ -1,40 +0,0 @@ -/* - * Copyright 2007-2008 MIYAMOTO Daisuke, jiemamy.org and the Others. Created on 2008/07/02 - * - * This file is part of Jiemamy. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.jiemamy.spec.event.model.constraint; - -/** - * Event関連の処理をModel内に直接記述するとModelのSourceの可読性が低くなるため、ConstraintSetModelからそれらを引き受ける。 - * 近々削除されます! - * @author shin1ogawa - */ - @ Deprecated -public interface ConstraintSetModelChangeSupport { - - /** - * ConstraintSetModel自身のEventを監視するListenerを追加する。 - * - * @param l {@link ConstraintSetModelChangeListener} - * @see #removeConstraintSetModelChangeListener(ConstraintSetModelChangeListener) - */ - void addConstraintSetModelChangeListener(ConstraintSetModelChangeListener l); - - /** - * ConstraintSetModel自身のEventを監視するListenerを削除する。 - * - * @param l {@link ConstraintSetModelChangeListener} - * @see #addConstraintSetModelChangeListener(ConstraintSetModelChangeListener) - */ - void removeConstraintSetModelChangeListener(ConstraintSetModelChangeListener l); -} Copied: zeus/trunk/org.jiemamy.spec.event/src/main/java/org/jiemamy/spec/event/model/constraint/ConstraintsModelChangeListener.java (from rev 2060, zeus/trunk/org.jiemamy.spec.event/src/main/java/org/jiemamy/spec/event/model/constraint/ConstraintSetModelChangeListener.java) =================================================================== --- zeus/trunk/org.jiemamy.spec.event/src/main/java/org/jiemamy/spec/event/model/constraint/ConstraintsModelChangeListener.java (rev 0) +++ zeus/trunk/org.jiemamy.spec.event/src/main/java/org/jiemamy/spec/event/model/constraint/ConstraintsModelChangeListener.java 2008-10-30 15:28:37 UTC (rev 2064) @@ -0,0 +1,27 @@ +/* + * Copyright 2007-2008 MIYAMOTO Daisuke, jiemamy.org and the Others. Created on 2008/06/29 + * + * This file is part of Jiemamy. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.jiemamy.spec.event.model.constraint; + +import org.jiemamy.spec.event.ModelChangeListener; + +/** + * ConstraintSetModel用のListener。 + * 近々削除されます! + * @author shin1ogawa + */ + @ Deprecated +public interface ConstraintsModelChangeListener extends ModelChangeListener { + +} Property changes on: zeus/trunk/org.jiemamy.spec.event/src/main/java/org/jiemamy/spec/event/model/constraint/ConstraintsModelChangeListener.java ___________________________________________________________________ Name: svn:mime-type + text/plain Copied: zeus/trunk/org.jiemamy.spec.event/src/main/java/org/jiemamy/spec/event/model/constraint/ConstraintsModelChangeSupport.java (from rev 2060, zeus/trunk/org.jiemamy.spec.event/src/main/java/org/jiemamy/spec/event/model/constraint/ConstraintSetModelChangeSupport.java) =================================================================== --- zeus/trunk/org.jiemamy.spec.event/src/main/java/org/jiemamy/spec/event/model/constraint/ConstraintsModelChangeSupport.java (rev 0) +++ zeus/trunk/org.jiemamy.spec.event/src/main/java/org/jiemamy/spec/event/model/constraint/ConstraintsModelChangeSupport.java 2008-10-30 15:28:37 UTC (rev 2064) @@ -0,0 +1,40 @@ +/* + * Copyright 2007-2008 MIYAMOTO Daisuke, jiemamy.org and the Others. Created on 2008/07/02 + * + * This file is part of Jiemamy. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.jiemamy.spec.event.model.constraint; + +/** + * Event関連の処理をModel内に直接記述するとModelのSourceの可読性が低くなるため、ConstraintSetModelからそれらを引き受ける。 + * 近々削除されます! + * @author shin1ogawa + */ + @ Deprecated +public interface ConstraintsModelChangeSupport { + + /** + * ConstraintSetModel自身のEventを監視するListenerを追加する。 + * + * @param l {@link ConstraintsModelChangeListener} + * @see #removeConstraintSetModelChangeListener(ConstraintsModelChangeListener) + */ + void addConstraintSetModelChangeListener(ConstraintsModelChangeListener l); + + /** + * ConstraintSetModel自身のEventを監視するListenerを削除する。 + * + * @param l {@link ConstraintsModelChangeListener} + * @see #addConstraintSetModelChangeListener(ConstraintsModelChangeListener) + */ + void removeConstraintSetModelChangeListener(ConstraintsModelChangeListener l); +} Property changes on: zeus/trunk/org.jiemamy.spec.event/src/main/java/org/jiemamy/spec/event/model/constraint/ConstraintsModelChangeSupport.java ___________________________________________________________________ Name: svn:mime-type + text/plain