svnno****@sourc*****
svnno****@sourc*****
2008年 12月 29日 (月) 22:03:56 JST
Revision: 2331 http://svn.sourceforge.jp/view?root=jiemamy&view=rev&rev=2331 Author: daisuke_m Date: 2008-12-29 22:03:56 +0900 (Mon, 29 Dec 2008) Log Message: ----------- DataTypeまわりを整理。(DataTypeDescriptorをDataTypeにリネーム) Modified Paths: -------------- artemis/trunk/org.jiemamy.artemis.test/src/test/java/org/jiemamy/artemis/ApplicationModelCreator.java artemis/trunk/org.jiemamy.composer/src/test/java/org/jiemamy/composer/importer/DatabaseImporterTest.java artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/dialect/AbstractDialect.java artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/dialect/DefaultDataTypeResolver.java artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/dialect/openjpa/OpenJpaTableAdapter.java artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/internal/processor/SetDefaultColumnsProcessor.java artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/model/attribute/ColumnModelImpl.java artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/model/datatype/BigIntegerDesc.java artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/model/datatype/BlobDesc.java artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/model/datatype/CharacterDesc.java artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/model/datatype/ClobDesc.java artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/model/datatype/DomainModelImpl.java artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/model/datatype/GenericDesc.java artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/model/datatype/IntegerDesc.java artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/model/datatype/NumericDesc.java artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/model/datatype/RealDesc.java artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/model/datatype/TimestampDesc.java artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/model/datatype/VarcharDesc.java artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/utils/builder/ColumnBuilder.java artemis/trunk/org.jiemamy.core/src/test/java/org/jiemamy/dialect/generic/GenericDialectTest.java artemis/trunk/org.jiemamy.core/src/test/java/org/jiemamy/dialect/openjpa/OpenJpaGenerateSqlTest.java artemis/trunk/org.jiemamy.core/src/test/java/org/jiemamy/model/EmptyProxyModel.java artemis/trunk/org.jiemamy.core/src/test/java/org/jiemamy/model/RootModelImplTest.java artemis/trunk/org.jiemamy.core/src/test/java/org/jiemamy/model/node/TableModelImplTest.java artemis/trunk/org.jiemamy.core/src/test/java/org/jiemamy/utils/builder/ModelBuilderTest.java artemis/trunk/org.jiemamy.dialect.postgresql/src/test/java/org/jiemamy/dialect/postgresql/PostgresqlDialectTest.java artemis/trunk/org.jiemamy.event/src/test/java/org/jiemamy/model/RootModelEventTest.java artemis/trunk/org.jiemamy.event/src/test/java/org/jiemamy/util/ObservableListTest.java artemis/trunk/org.jiemamy.event/src/test/java/org/jiemamy/util/ObservableMapTest.java zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/dialect/DataTypeResolver.java zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/model/attribute/ColumnModel.java zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/model/datatype/DataTypeAdapter.java zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/model/datatype/DomainModel.java zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/xml/Nodes.java Added Paths: ----------- artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/model/datatype/AbstractDataType.java zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/model/datatype/DataType.java Removed Paths: ------------- artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/model/datatype/AbstractDataTypeDescriptor.java zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/model/datatype/DataTypeDescriptor.java -------------- next part -------------- Modified: artemis/trunk/org.jiemamy.artemis.test/src/test/java/org/jiemamy/artemis/ApplicationModelCreator.java =================================================================== --- artemis/trunk/org.jiemamy.artemis.test/src/test/java/org/jiemamy/artemis/ApplicationModelCreator.java 2008-12-29 12:54:58 UTC (rev 2330) +++ artemis/trunk/org.jiemamy.artemis.test/src/test/java/org/jiemamy/artemis/ApplicationModelCreator.java 2008-12-29 13:03:56 UTC (rev 2331) @@ -78,7 +78,7 @@ // ドメインの生成 DomainModel idDomain = factory.newModel(DomainModel.class); idDomain.setName("ID"); - idDomain.setDataTypeDescriptor(new IntegerDesc()); + idDomain.setDataType(new IntegerDesc()); idDomain.setNotNull(true); idDomain.addConstraint(factory.newModel(UniqueConstraintModel.class)); idDomain.registerAdapter(new SerialDataTypeAdapter()); @@ -86,7 +86,7 @@ DomainModel nameDomain = factory.newModel(DomainModel.class); nameDomain.setName("NAME"); - nameDomain.setDataTypeDescriptor(new VarcharDesc(32)); + nameDomain.setDataType(new VarcharDesc(32)); nameDomain.setDescription("人名用の型です。"); rootModel.appendModel(nameDomain); @@ -249,7 +249,7 @@ ColumnModel idColumn = factory.newModel(ColumnModel.class); idColumn.setName("ID"); - idColumn.setDataTypeDescriptor(idDomain); + idColumn.setDataType(idDomain); idColumn.setLogicalName("部署ID"); deptTable.appendModel(idColumn); @@ -259,20 +259,20 @@ ColumnModel noColumn = factory.newModel(ColumnModel.class); noColumn.setName("DEPT_NO"); - noColumn.setDataTypeDescriptor(new IntegerDesc()); + noColumn.setDataType(new IntegerDesc()); noColumn.setLogicalName("部署番号"); deptTable.appendModel(noColumn); ColumnModel deptNameColumn = factory.newModel(ColumnModel.class); deptNameColumn.setName("DEPT_NAME"); - deptNameColumn.setDataTypeDescriptor(new VarcharDesc(20)); + deptNameColumn.setDataType(new VarcharDesc(20)); deptNameColumn.setLogicalName("部署名"); deptNameColumn.setRepresentation(true); deptTable.appendModel(deptNameColumn); ColumnModel locColumn = factory.newModel(ColumnModel.class); locColumn.setName("LOC"); - locColumn.setDataTypeDescriptor(new VarcharDesc(20)); + locColumn.setDataType(new VarcharDesc(20)); locColumn.setLogicalName("ロケーション"); locColumn.setDefaultValue("secret"); deptTable.appendModel(locColumn); @@ -477,7 +477,7 @@ ColumnModel idColumn = factory.newModel(ColumnModel.class); idColumn.setName("ID"); - idColumn.setDataTypeDescriptor(idDomain); + idColumn.setDataType(idDomain); idColumn.setLogicalName("従業員ID"); empTable.appendModel(idColumn); @@ -487,14 +487,14 @@ ColumnModel noColumn = factory.newModel(ColumnModel.class); noColumn.setName("EMP_NO"); - noColumn.setDataTypeDescriptor(new IntegerDesc()); + noColumn.setDataType(new IntegerDesc()); noColumn.setNotNull(true); noColumn.setLogicalName("従業員番号"); empTable.appendModel(noColumn); ColumnModel nameColumn = factory.newModel(ColumnModel.class); nameColumn.setName("EMP_NAME"); - nameColumn.setDataTypeDescriptor(nameDomain); + nameColumn.setDataType(nameDomain); nameColumn.setNotNull(true); nameColumn.setLogicalName("従業員名"); nameColumn.setDefaultValue("no name"); @@ -503,25 +503,25 @@ ColumnModel mgrColumn = factory.newModel(ColumnModel.class); mgrColumn.setName("MGR_ID"); - mgrColumn.setDataTypeDescriptor(new IntegerDesc()); + mgrColumn.setDataType(new IntegerDesc()); nameColumn.setLogicalName("上司ID"); empTable.appendModel(mgrColumn); ColumnModel hireColumn = factory.newModel(ColumnModel.class); hireColumn.setName("HIREDATE"); - hireColumn.setDataTypeDescriptor(new TimestampDesc()); + hireColumn.setDataType(new TimestampDesc()); hireColumn.setNotNull(true); empTable.appendModel(hireColumn); ColumnModel salColumn = factory.newModel(ColumnModel.class); salColumn.setName("SAL"); - salColumn.setDataTypeDescriptor(new NumericDesc(7, 2)); + salColumn.setDataType(new NumericDesc(7, 2)); salColumn.setNotNull(true); empTable.appendModel(salColumn); ColumnModel deptColumn = factory.newModel(ColumnModel.class); deptColumn.setName("DEPT_ID"); - deptColumn.setDataTypeDescriptor(new IntegerDesc()); + deptColumn.setDataType(new IntegerDesc()); deptColumn.setNotNull(true); empTable.appendModel(deptColumn); Modified: artemis/trunk/org.jiemamy.composer/src/test/java/org/jiemamy/composer/importer/DatabaseImporterTest.java =================================================================== --- artemis/trunk/org.jiemamy.composer/src/test/java/org/jiemamy/composer/importer/DatabaseImporterTest.java 2008-12-29 12:54:58 UTC (rev 2330) +++ artemis/trunk/org.jiemamy.composer/src/test/java/org/jiemamy/composer/importer/DatabaseImporterTest.java 2008-12-29 13:03:56 UTC (rev 2331) @@ -128,17 +128,17 @@ ColumnModel column1 = pollTable.getColumns().get(0); logger.info(" Column - " + column1.getName()); assertThat(column1.getName(), is("poll_id")); - assertThat(column1.getDataTypeDescriptor(), instanceOf(IntegerDesc.class)); + assertThat(column1.getDataType(), instanceOf(IntegerDesc.class)); // FIXME この仕様はまだ未実装 -// assertThat(column1.getDataTypeDescriptor().hasAdapter(SerialDataTypeAdapter.class), is(true)); +// assertThat(column1.getDataType().hasAdapter(SerialDataTypeAdapter.class), is(true)); assertThat(column1, isIn(pollTable.getPrimaryKey().getColumns())); ColumnModel column2 = pollTable.getColumns().get(1); logger.info(" Column - " + column2.getName()); assertThat(column2.getName(), is("title")); - assertThat(column2.getDataTypeDescriptor(), instanceOf(VarcharDesc.class)); - assertThat(column2.getDataTypeDescriptor().getAdapter(SizedDataTypeAdapter.class).getSize(), is(128)); - assertThat(((VarcharDesc) column2.getDataTypeDescriptor()).getSize(), is(128)); + assertThat(column2.getDataType(), instanceOf(VarcharDesc.class)); + assertThat(column2.getDataType().getAdapter(SizedDataTypeAdapter.class).getSize(), is(128)); + assertThat(((VarcharDesc) column2.getDataType()).getSize(), is(128)); assertThat(column2, not(isIn(pollTable.getPrimaryKey().getColumns()))); ForeignKeyModel foreignKeyModel = (ForeignKeyModel) pollTable.getTargetConnections().iterator().next(); Modified: artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/dialect/AbstractDialect.java =================================================================== --- artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/dialect/AbstractDialect.java 2008-12-29 12:54:58 UTC (rev 2330) +++ artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/dialect/AbstractDialect.java 2008-12-29 13:03:56 UTC (rev 2331) @@ -34,7 +34,7 @@ import org.jiemamy.model.RootModel; import org.jiemamy.model.attribute.ColumnModel; import org.jiemamy.model.constraint.PrimaryKeyConstraintModel; -import org.jiemamy.model.datatype.DataTypeDescriptor; +import org.jiemamy.model.datatype.DataType; import org.jiemamy.model.datatype.adapter.SizedDataTypeAdapter; import org.jiemamy.model.node.AbstractEntityModel; import org.jiemamy.model.node.TableModel; @@ -203,18 +203,18 @@ * {@inheritDoc} */ public List<ColumnModel> visit(ResultSet element) throws SQLException { - DataTypeDescriptor dataTypeDescriptor = - getDataTypeResolver().resolveDataTypeDescriptor(factory, element.getString("TYPE_NAME")); + DataType dataType = + getDataTypeResolver().resolveDataType(factory, element.getString("TYPE_NAME")); String name = element.getString("COLUMN_NAME"); ColumnModel column = factory.newModel(ColumnModel.class); column.setName(name); - column.setDataTypeDescriptor(dataTypeDescriptor); + column.setDataType(dataType); columns.add(column); - if (dataTypeDescriptor.hasAdapter(SizedDataTypeAdapter.class)) { - SizedDataTypeAdapter sized = dataTypeDescriptor.getAdapter(SizedDataTypeAdapter.class); + if (dataType.hasAdapter(SizedDataTypeAdapter.class)) { + SizedDataTypeAdapter sized = dataType.getAdapter(SizedDataTypeAdapter.class); try { int size = Integer.valueOf(element.getString("COLUMN_SIZE")); sized.setSize(size); Modified: artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/dialect/DefaultDataTypeResolver.java =================================================================== --- artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/dialect/DefaultDataTypeResolver.java 2008-12-29 12:54:58 UTC (rev 2330) +++ artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/dialect/DefaultDataTypeResolver.java 2008-12-29 13:03:56 UTC (rev 2331) @@ -22,13 +22,12 @@ import org.apache.commons.lang.builder.ToStringBuilder; import org.apache.commons.lang.builder.ToStringStyle; -import org.h2.value.DataType; import org.jiemamy.JiemamyFactory; -import org.jiemamy.model.datatype.DataTypeDescriptor; +import org.jiemamy.model.datatype.DataType; /** - * SQL方言において、{@link DataTypeDescriptor}と{@link DataType}間の解決を行うクラス。 + * SQL方言において、{@link DataType}と{@link DataType}間の解決を行うクラス。 * @author daisuke */ public class DefaultDataTypeResolver implements DataTypeResolver { @@ -44,14 +43,14 @@ /** * {@inheritDoc} */ - public String resolveDataType(DataTypeDescriptor dataTypeDescriptor) { - return dataTypeDescriptor.getTypeName(); + public String resolveDataType(DataType dataType) { + return dataType.getTypeName(); } /** * {@inheritDoc} */ - public DataTypeDescriptor resolveDataTypeDescriptor(JiemamyFactory factory, String typeName) { + public DataType resolveDataType(JiemamyFactory factory, String typeName) { // TODO Auto-generated method stub return null; } Modified: artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/dialect/openjpa/OpenJpaTableAdapter.java =================================================================== --- artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/dialect/openjpa/OpenJpaTableAdapter.java 2008-12-29 12:54:58 UTC (rev 2330) +++ artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/dialect/openjpa/OpenJpaTableAdapter.java 2008-12-29 13:03:56 UTC (rev 2331) @@ -35,7 +35,7 @@ import org.jiemamy.exception.TooManyElementsException; import org.jiemamy.model.attribute.ColumnModel; -import org.jiemamy.model.datatype.DataTypeDescriptor; +import org.jiemamy.model.datatype.DataType; import org.jiemamy.model.datatype.adapter.SizedDataTypeAdapter; import org.jiemamy.model.node.TableModel; @@ -299,7 +299,7 @@ @Override public int getSize() { - DataTypeDescriptor dt = jiemamyColumn.getDataTypeDescriptor(); + DataType dt = jiemamyColumn.getDataType(); if (dt.hasAdapter(SizedDataTypeAdapter.class)) { return dt.getAdapter(SizedDataTypeAdapter.class).getSize(); } @@ -336,7 +336,7 @@ @Override public String getTypeName() { - return jiemamyColumn.getDataTypeDescriptor().toString(); + return jiemamyColumn.getDataType().toString(); } @Override Modified: artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/internal/processor/SetDefaultColumnsProcessor.java =================================================================== --- artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/internal/processor/SetDefaultColumnsProcessor.java 2008-12-29 12:54:58 UTC (rev 2330) +++ artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/internal/processor/SetDefaultColumnsProcessor.java 2008-12-29 13:03:56 UTC (rev 2331) @@ -75,13 +75,13 @@ try { ColumnModel sameNameColumn = sourceTable.getColumn(referencePkColumn.getName()); - if (referencePkColumn.getDataTypeDescriptor().equals(sameNameColumn.getDataTypeDescriptor())) { + if (referencePkColumn.getDataType().equals(sameNameColumn.getDataType())) { mapping.setConstraintColumn(sameNameColumn); } } catch (TooManyElementsException e) { for (Object element : e.getElements()) { ColumnModel sameNameColumn = (ColumnModel) element; - if (referencePkColumn.getDataTypeDescriptor().equals(sameNameColumn.getDataTypeDescriptor())) { + if (referencePkColumn.getDataType().equals(sameNameColumn.getDataType())) { mapping.setConstraintColumn(sameNameColumn); } } @@ -93,13 +93,13 @@ // sourceに新しいカラムを作成 ColumnModel additionalColumn = factory.newModel(ColumnModel.class); additionalColumn.setName(referencePkColumn.getName()); - additionalColumn.setDataTypeDescriptor(referencePkColumn.getDataTypeDescriptor()); + additionalColumn.setDataType(referencePkColumn.getDataType()); additionalColumn.setLogicalName(referencePkColumn.getLogicalName()); sourceTable.appendModel(additionalColumn); mapping.setConstraintColumn(additionalColumn); } else { for (ColumnModel column : sourceTable.getColumns()) { - if (referencePkColumn.getDataTypeDescriptor().equals(column.getDataTypeDescriptor())) { + if (referencePkColumn.getDataType().equals(column.getDataType())) { mapping.setConstraintColumn(column); } } Modified: artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/model/attribute/ColumnModelImpl.java =================================================================== --- artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/model/attribute/ColumnModelImpl.java 2008-12-29 12:54:58 UTC (rev 2330) +++ artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/model/attribute/ColumnModelImpl.java 2008-12-29 13:03:56 UTC (rev 2331) @@ -23,7 +23,7 @@ import org.apache.commons.lang.builder.ToStringBuilder; import org.apache.commons.lang.builder.ToStringStyle; -import org.jiemamy.model.datatype.DataTypeDescriptor; +import org.jiemamy.model.datatype.DataType; import org.jiemamy.model.datatype.DomainModel; /** @@ -41,7 +41,7 @@ private String logicalName; /** 型記述子 */ - private DataTypeDescriptor dataTypeDescriptor; + private DataType dataType; /** デフォルト値 */ private String defaultValue; @@ -80,16 +80,16 @@ /** * {@inheritDoc} */ - public DataTypeDescriptor getDataTypeDescriptor() { - return dataTypeDescriptor; + public DataType getDataType() { + return dataType; } /** * {@inheritDoc} */ public String getDefaultValue() { - if (dataTypeDescriptor instanceof DomainModel && defaultValue == null) { - DomainModel domainModel = (DomainModel) dataTypeDescriptor; + if (dataType instanceof DomainModel && defaultValue == null) { + DomainModel domainModel = (DomainModel) dataType; return domainModel.getDefaultValue(); } return defaultValue; @@ -106,8 +106,8 @@ * {@inheritDoc} */ public String getFreeString() { - if (dataTypeDescriptor instanceof DomainModel && freeString == null) { - DomainModel domainModel = (DomainModel) dataTypeDescriptor; + if (dataType instanceof DomainModel && freeString == null) { + DomainModel domainModel = (DomainModel) dataType; return domainModel.getFreeString(); } return freeString; @@ -144,8 +144,8 @@ /** * {@inheritDoc} */ - public void setDataTypeDescriptor(DataTypeDescriptor dataTypeDescriptor) { - this.dataTypeDescriptor = dataTypeDescriptor; + public void setDataType(DataType dataType) { + this.dataType = dataType; } /** Copied: artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/model/datatype/AbstractDataType.java (from rev 2330, artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/model/datatype/AbstractDataTypeDescriptor.java) =================================================================== --- artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/model/datatype/AbstractDataType.java (rev 0) +++ artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/model/datatype/AbstractDataType.java 2008-12-29 13:03:56 UTC (rev 2331) @@ -0,0 +1,138 @@ +/* + * Copyright 2007-2008 MIYAMOTO Daisuke, jiemamy.org and the Others. + * Created on 2008/12/10 + * + * 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.model.datatype; + +import java.lang.reflect.Field; +import java.sql.Types; +import java.util.List; + +import org.apache.commons.lang.builder.ToStringBuilder; +import org.apache.commons.lang.builder.ToStringStyle; + +import org.jiemamy.exception.UnexpectedConditionError; +import org.jiemamy.internal.AdapterManager; + +/** + * {@link DataType}の骨格実装クラス。 + * @author daisuke + */ +public abstract class AbstractDataType implements DataType { + + private int sqlType; + + private AdapterManager adapterManager = new AdapterManager(); + + + /** + * コンストラクタ。 + * @category instance creation + */ + public AbstractDataType() { + } + + /** + * コンストラクタ。 + * @param sqlType + * @category instance creation + */ + public AbstractDataType(int sqlType) { + setSqlType(sqlType); + } + + /** + * {@inheritDoc} + */ + public <T>T getAdapter(Class<T> adapterClass) { + return adapterManager.getAdapter(adapterClass); + } + + /** + * {@inheritDoc} + */ + public List<Object> getAdapters() { + return adapterManager.getAdapters(); + } + + /** + * {@inheritDoc} + */ + public int getSqlType() { + return sqlType; + } + + /** + * {@inheritDoc} + */ + public String getTypeName() { + // TODO Auto-generated method stub + return null; + } + + /** + * {@inheritDoc} + */ + public boolean hasAdapter(Class<?> adapterClass) { + return adapterManager.hasAdapter(adapterClass); + } + + /** + * {@inheritDoc} + */ + public void registerAdapter(Object adapter) { + adapterManager.registerAdapter(adapter); + } + + /** + * {@inheritDoc} + */ + public void setSqlType(int sqlType) { + Field[] fields = Types.class.getDeclaredFields(); + for (Field field : fields) { + try { + int value = (Integer) field.get(null); + if (sqlType == value) { + this.sqlType = sqlType; + return; + } + } catch (IllegalArgumentException e) { + throw new UnexpectedConditionError("Illegal Java Implementation (java.sql.Types)."); + } catch (IllegalAccessException e) { + throw new UnexpectedConditionError("Illegal Java Implementation (java.sql.Types)."); + } + } + throw new IllegalArgumentException(); + } + + /** + * {@inheritDoc} + */ + public void setTypeName(String typeName) { + // TODO Auto-generated method stub + + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE); + } + +} Property changes on: artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/model/datatype/AbstractDataType.java ___________________________________________________________________ Name: svn:mime-type + text/plain Deleted: artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/model/datatype/AbstractDataTypeDescriptor.java =================================================================== --- artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/model/datatype/AbstractDataTypeDescriptor.java 2008-12-29 12:54:58 UTC (rev 2330) +++ artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/model/datatype/AbstractDataTypeDescriptor.java 2008-12-29 13:03:56 UTC (rev 2331) @@ -1,138 +0,0 @@ -/* - * Copyright 2007-2008 MIYAMOTO Daisuke, jiemamy.org and the Others. - * Created on 2008/12/10 - * - * 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.model.datatype; - -import java.lang.reflect.Field; -import java.sql.Types; -import java.util.List; - -import org.apache.commons.lang.builder.ToStringBuilder; -import org.apache.commons.lang.builder.ToStringStyle; - -import org.jiemamy.exception.UnexpectedConditionError; -import org.jiemamy.internal.AdapterManager; - -/** - * {@link DataTypeDescriptor}の骨格実装クラス。 - * @author daisuke - */ -public abstract class AbstractDataTypeDescriptor implements DataTypeDescriptor { - - private int sqlType; - - private AdapterManager adapterManager = new AdapterManager(); - - - /** - * コンストラクタ。 - * @category instance creation - */ - public AbstractDataTypeDescriptor() { - } - - /** - * コンストラクタ。 - * @param sqlType - * @category instance creation - */ - public AbstractDataTypeDescriptor(int sqlType) { - setSqlType(sqlType); - } - - /** - * {@inheritDoc} - */ - public <T>T getAdapter(Class<T> adapterClass) { - return adapterManager.getAdapter(adapterClass); - } - - /** - * {@inheritDoc} - */ - public List<Object> getAdapters() { - return adapterManager.getAdapters(); - } - - /** - * {@inheritDoc} - */ - public int getSqlType() { - return sqlType; - } - - /** - * {@inheritDoc} - */ - public String getTypeName() { - // TODO Auto-generated method stub - return null; - } - - /** - * {@inheritDoc} - */ - public boolean hasAdapter(Class<?> adapterClass) { - return adapterManager.hasAdapter(adapterClass); - } - - /** - * {@inheritDoc} - */ - public void registerAdapter(Object adapter) { - adapterManager.registerAdapter(adapter); - } - - /** - * {@inheritDoc} - */ - public void setSqlType(int sqlType) { - Field[] fields = Types.class.getDeclaredFields(); - for (Field field : fields) { - try { - int value = (Integer) field.get(null); - if (sqlType == value) { - this.sqlType = sqlType; - return; - } - } catch (IllegalArgumentException e) { - throw new UnexpectedConditionError("Illegal Java Implementation (java.sql.Types)."); - } catch (IllegalAccessException e) { - throw new UnexpectedConditionError("Illegal Java Implementation (java.sql.Types)."); - } - } - throw new IllegalArgumentException(); - } - - /** - * {@inheritDoc} - */ - public void setTypeName(String typeName) { - // TODO Auto-generated method stub - - } - - /** - * {@inheritDoc} - */ - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE); - } - -} Modified: artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/model/datatype/BigIntegerDesc.java =================================================================== --- artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/model/datatype/BigIntegerDesc.java 2008-12-29 12:54:58 UTC (rev 2330) +++ artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/model/datatype/BigIntegerDesc.java 2008-12-29 13:03:56 UTC (rev 2331) @@ -25,7 +25,7 @@ * @author daisuke */ @SuppressWarnings("serial") -public class BigIntegerDesc extends AbstractDataTypeDescriptor { +public class BigIntegerDesc extends AbstractDataType { /** * コンストラクタ。 Modified: artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/model/datatype/BlobDesc.java =================================================================== --- artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/model/datatype/BlobDesc.java 2008-12-29 12:54:58 UTC (rev 2330) +++ artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/model/datatype/BlobDesc.java 2008-12-29 13:03:56 UTC (rev 2331) @@ -25,7 +25,7 @@ * @author daisuke */ @SuppressWarnings("serial") -public class BlobDesc extends AbstractDataTypeDescriptor { +public class BlobDesc extends AbstractDataType { /** * コンストラクタ。 Modified: artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/model/datatype/CharacterDesc.java =================================================================== --- artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/model/datatype/CharacterDesc.java 2008-12-29 12:54:58 UTC (rev 2330) +++ artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/model/datatype/CharacterDesc.java 2008-12-29 13:03:56 UTC (rev 2331) @@ -27,7 +27,7 @@ * @author daisuke */ @SuppressWarnings("serial") -public class CharacterDesc extends AbstractDataTypeDescriptor { +public class CharacterDesc extends AbstractDataType { /** * コンストラクタ。 Modified: artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/model/datatype/ClobDesc.java =================================================================== --- artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/model/datatype/ClobDesc.java 2008-12-29 12:54:58 UTC (rev 2330) +++ artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/model/datatype/ClobDesc.java 2008-12-29 13:03:56 UTC (rev 2331) @@ -25,7 +25,7 @@ * @author daisuke */ @SuppressWarnings("serial") -public class ClobDesc extends AbstractDataTypeDescriptor { +public class ClobDesc extends AbstractDataType { /** * コンストラクタ。 Modified: artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/model/datatype/DomainModelImpl.java =================================================================== --- artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/model/datatype/DomainModelImpl.java 2008-12-29 12:54:58 UTC (rev 2330) +++ artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/model/datatype/DomainModelImpl.java 2008-12-29 13:03:56 UTC (rev 2331) @@ -43,7 +43,7 @@ private String logicalName; /** ドメインとして定義された型記述子 */ - private DataTypeDescriptor dataTypeDescriptor; + private DataType dataType; private boolean notNull; @@ -95,27 +95,27 @@ * {@inheritDoc} */ public <T>T getAdapter(Class<T> adapterClass) { - if (dataTypeDescriptor == null) { - throw new IllegalStateException("dataTypeDescriptor is null."); + if (dataType == null) { + throw new IllegalStateException("dataType is null."); } - return dataTypeDescriptor.getAdapter(adapterClass); + return dataType.getAdapter(adapterClass); } /** * {@inheritDoc} */ public List<Object> getAdapters() { - if (dataTypeDescriptor == null) { - throw new IllegalStateException("dataTypeDescriptor is null."); + if (dataType == null) { + throw new IllegalStateException("dataType is null."); } - return dataTypeDescriptor.getAdapters(); + return dataType.getAdapters(); } /** * {@inheritDoc} */ - public DataTypeDescriptor getDataTypeDescriptor() { - return dataTypeDescriptor; + public DataType getDataType() { + return dataType; } /** @@ -165,24 +165,24 @@ * {@inheritDoc} */ public int getSqlType() { - return dataTypeDescriptor.getSqlType(); + return dataType.getSqlType(); } /** * {@inheritDoc} */ public String getTypeName() { - return dataTypeDescriptor.getTypeName(); + return dataType.getTypeName(); } /** * {@inheritDoc} */ public boolean hasAdapter(Class<?> adapterClass) { - if (dataTypeDescriptor == null) { - throw new IllegalStateException("dataTypeDescriptor is null."); + if (dataType == null) { + throw new IllegalStateException("dataType is null."); } - return dataTypeDescriptor.hasAdapter(adapterClass); + return dataType.hasAdapter(adapterClass); } /** @@ -204,17 +204,17 @@ * {@inheritDoc} */ public void registerAdapter(Object adapter) { - if (dataTypeDescriptor == null) { - throw new IllegalStateException("dataTypeDescriptor is null."); + if (dataType == null) { + throw new IllegalStateException("dataType is null."); } - dataTypeDescriptor.registerAdapter(adapter); + dataType.registerAdapter(adapter); } /** * {@inheritDoc} */ - public void setDataTypeDescriptor(DataTypeDescriptor dataTypeDescriptor) { - this.dataTypeDescriptor = dataTypeDescriptor; + public void setDataType(DataType dataType) { + this.dataType = dataType; } /** @@ -263,14 +263,14 @@ * {@inheritDoc} */ public void setSqlType(int sqlType) { - dataTypeDescriptor.setSqlType(sqlType); + dataType.setSqlType(sqlType); } /** * {@inheritDoc} */ public void setTypeName(String typeName) { - dataTypeDescriptor.setTypeName(typeName); + dataType.setTypeName(typeName); } /** @@ -278,7 +278,7 @@ */ @Override public String toString() { - return name + ":" + ObjectUtils.toString(dataTypeDescriptor, "null"); + return name + ":" + ObjectUtils.toString(dataType, "null"); } } Modified: artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/model/datatype/GenericDesc.java =================================================================== --- artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/model/datatype/GenericDesc.java 2008-12-29 12:54:58 UTC (rev 2330) +++ artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/model/datatype/GenericDesc.java 2008-12-29 13:03:56 UTC (rev 2331) @@ -24,7 +24,7 @@ * 一般的な型記述子。 * @author daisuke */ -public class GenericDesc extends AbstractDataTypeDescriptor { +public class GenericDesc extends AbstractDataType { /** * コンストラクタ。 Modified: artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/model/datatype/IntegerDesc.java =================================================================== --- artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/model/datatype/IntegerDesc.java 2008-12-29 12:54:58 UTC (rev 2330) +++ artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/model/datatype/IntegerDesc.java 2008-12-29 13:03:56 UTC (rev 2331) @@ -25,7 +25,7 @@ * @author daisuke */ @SuppressWarnings("serial") -public class IntegerDesc extends AbstractDataTypeDescriptor { +public class IntegerDesc extends AbstractDataType { private boolean serial; Modified: artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/model/datatype/NumericDesc.java =================================================================== --- artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/model/datatype/NumericDesc.java 2008-12-29 12:54:58 UTC (rev 2330) +++ artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/model/datatype/NumericDesc.java 2008-12-29 13:03:56 UTC (rev 2331) @@ -27,7 +27,7 @@ * @author daisuke */ @SuppressWarnings("serial") -public class NumericDesc extends AbstractDataTypeDescriptor { +public class NumericDesc extends AbstractDataType { /** * コンストラクタ。 Modified: artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/model/datatype/RealDesc.java =================================================================== --- artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/model/datatype/RealDesc.java 2008-12-29 12:54:58 UTC (rev 2330) +++ artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/model/datatype/RealDesc.java 2008-12-29 13:03:56 UTC (rev 2331) @@ -25,7 +25,7 @@ * @author daisuke */ @SuppressWarnings("serial") -public class RealDesc extends AbstractDataTypeDescriptor { +public class RealDesc extends AbstractDataType { /** * コンストラクタ。 Modified: artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/model/datatype/TimestampDesc.java =================================================================== --- artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/model/datatype/TimestampDesc.java 2008-12-29 12:54:58 UTC (rev 2330) +++ artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/model/datatype/TimestampDesc.java 2008-12-29 13:03:56 UTC (rev 2331) @@ -27,7 +27,7 @@ * @author daisuke */ @SuppressWarnings("serial") -public class TimestampDesc extends AbstractDataTypeDescriptor { +public class TimestampDesc extends AbstractDataType { /** * コンストラクタ。 Modified: artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/model/datatype/VarcharDesc.java =================================================================== --- artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/model/datatype/VarcharDesc.java 2008-12-29 12:54:58 UTC (rev 2330) +++ artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/model/datatype/VarcharDesc.java 2008-12-29 13:03:56 UTC (rev 2331) @@ -27,7 +27,7 @@ * @author daisuke */ @SuppressWarnings("serial") -public class VarcharDesc extends AbstractDataTypeDescriptor { +public class VarcharDesc extends AbstractDataType { /** * コンストラクタ。 Modified: artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/utils/builder/ColumnBuilder.java =================================================================== --- artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/utils/builder/ColumnBuilder.java 2008-12-29 12:54:58 UTC (rev 2330) +++ artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/utils/builder/ColumnBuilder.java 2008-12-29 13:03:56 UTC (rev 2331) @@ -23,7 +23,7 @@ import org.jiemamy.JiemamyFactory; import org.jiemamy.model.attribute.ColumnModel; import org.jiemamy.model.constraint.Constraint; -import org.jiemamy.model.datatype.DataTypeDescriptor; +import org.jiemamy.model.datatype.DataType; /** * {@link ColumnModel}を構築するためのビルダークラス。 @@ -39,12 +39,12 @@ * @throws IllegalArgumentException 引数に{@code null}を与えた場合 * @category instance creation */ - public ColumnBuilder(JiemamyFactory factory, String name, DataTypeDescriptor type) { + public ColumnBuilder(JiemamyFactory factory, String name, DataType type) { super(factory, ColumnModel.class); Validate.notNull(name); Validate.notNull(type); model.setName(name); - model.setDataTypeDescriptor(type); + model.setDataType(type); } /** Modified: artemis/trunk/org.jiemamy.core/src/test/java/org/jiemamy/dialect/generic/GenericDialectTest.java =================================================================== --- artemis/trunk/org.jiemamy.core/src/test/java/org/jiemamy/dialect/generic/GenericDialectTest.java 2008-12-29 12:54:58 UTC (rev 2330) +++ artemis/trunk/org.jiemamy.core/src/test/java/org/jiemamy/dialect/generic/GenericDialectTest.java 2008-12-29 13:03:56 UTC (rev 2331) @@ -25,7 +25,7 @@ import org.junit.Before; import org.junit.Test; -import org.jiemamy.model.datatype.DataTypeDescriptor; +import org.jiemamy.model.datatype.DataType; import org.jiemamy.model.datatype.IntegerDesc; import org.jiemamy.model.datatype.NumericDesc; import org.jiemamy.model.datatype.TimestampDesc; @@ -89,7 +89,7 @@ */ @Test public void test04_VARCHAR型にサイズをセットして_その値を取得できる() throws Exception { - DataTypeDescriptor type = new VarcharDesc(); + DataType type = new VarcharDesc(); type.getAdapter(SizedDataTypeAdapter.class).setSize(304); assertThat(type.getAdapter(SizedDataTypeAdapter.class).getSize(), is(304)); Modified: artemis/trunk/org.jiemamy.core/src/test/java/org/jiemamy/dialect/openjpa/OpenJpaGenerateSqlTest.java =================================================================== --- artemis/trunk/org.jiemamy.core/src/test/java/org/jiemamy/dialect/openjpa/OpenJpaGenerateSqlTest.java 2008-12-29 12:54:58 UTC (rev 2330) +++ artemis/trunk/org.jiemamy.core/src/test/java/org/jiemamy/dialect/openjpa/OpenJpaGenerateSqlTest.java 2008-12-29 13:03:56 UTC (rev 2331) @@ -88,26 +88,26 @@ ColumnModel idColumn = factory.newModel(ColumnModel.class); idColumn.setName("ID"); - idColumn.setDataTypeDescriptor(new IntegerDesc()); + idColumn.setDataType(new IntegerDesc()); idColumn.setLogicalName("部署ID"); deptTable.appendModel(idColumn); ColumnModel noColumn = factory.newModel(ColumnModel.class); noColumn.setName("DEPT_NO"); - noColumn.setDataTypeDescriptor(new IntegerDesc()); + noColumn.setDataType(new IntegerDesc()); noColumn.setLogicalName("部署番号"); deptTable.appendModel(noColumn); ColumnModel deptNameColumn = factory.newModel(ColumnModel.class); deptNameColumn.setName("DEPT_NAME"); - deptNameColumn.setDataTypeDescriptor(new VarcharDesc(20)); + deptNameColumn.setDataType(new VarcharDesc(20)); deptNameColumn.setLogicalName("部署名"); deptNameColumn.setRepresentation(true); deptTable.appendModel(deptNameColumn); ColumnModel locColumn = factory.newModel(ColumnModel.class); locColumn.setName("LOC"); - locColumn.setDataTypeDescriptor(new VarcharDesc(20)); + locColumn.setDataType(new VarcharDesc(20)); locColumn.setLogicalName("ロケーション"); locColumn.setDefaultValue("secret"); deptTable.appendModel(locColumn); Modified: artemis/trunk/org.jiemamy.core/src/test/java/org/jiemamy/model/EmptyProxyModel.java =================================================================== --- artemis/trunk/org.jiemamy.core/src/test/java/org/jiemamy/model/EmptyProxyModel.java 2008-12-29 12:54:58 UTC (rev 2330) +++ artemis/trunk/org.jiemamy.core/src/test/java/org/jiemamy/model/EmptyProxyModel.java 2008-12-29 13:03:56 UTC (rev 2331) @@ -24,7 +24,7 @@ import org.jiemamy.model.connection.AbstractConnectionModel; import org.jiemamy.model.constraint.CheckConstraintModel; import org.jiemamy.model.dataset.InsertDataSetModel; -import org.jiemamy.model.datatype.DataTypeDescriptor; +import org.jiemamy.model.datatype.DataType; import org.jiemamy.model.datatype.DomainModel; import org.jiemamy.model.index.IndexModel; import org.jiemamy.model.node.AbstractNodeModel; @@ -35,8 +35,8 @@ */ public final class EmptyProxyModel { - /** {@link DataTypeDescriptor}の空実装 */ - public static final DataTypeDescriptor DATA_TYPE_DESC = Mockit.newEmptyProxy(DataTypeDescriptor.class); + /** {@link DataType}の空実装 */ + public static final DataType DATA_TYPE_DESC = Mockit.newEmptyProxy(DataType.class); /** {@link DomainModel}の空実装 */ public static final DomainModel DOMAIN = Mockit.newEmptyProxy(DomainModel.class); Modified: artemis/trunk/org.jiemamy.core/src/test/java/org/jiemamy/model/RootModelImplTest.java =================================================================== --- artemis/trunk/org.jiemamy.core/src/test/java/org/jiemamy/model/RootModelImplTest.java 2008-12-29 12:54:58 UTC (rev 2330) +++ artemis/trunk/org.jiemamy.core/src/test/java/org/jiemamy/model/RootModelImplTest.java 2008-12-29 13:03:56 UTC (rev 2331) @@ -151,7 +151,7 @@ DomainModel domain = factory.newModel(DomainModel.class); domain.setName("a"); - domain.setDataTypeDescriptor(new IntegerDesc()); + domain.setDataType(new IntegerDesc()); rootModel.appendModel(domain); rootModel.appendModel(source); rootModel.appendModel(target); @@ -199,10 +199,10 @@ // モデル構築 DomainModel domain1 = factory.newModel(DomainModel.class); domain1.setName("domain1"); - domain1.setDataTypeDescriptor(new IntegerDesc()); + domain1.setDataType(new IntegerDesc()); DomainModel domain2 = factory.newModel(DomainModel.class); domain2.setName("domain2"); - domain2.setDataTypeDescriptor(new IntegerDesc()); + domain2.setDataType(new IntegerDesc()); rootModel.appendModel(domain1); Modified: artemis/trunk/org.jiemamy.core/src/test/java/org/jiemamy/model/node/TableModelImplTest.java =================================================================== --- artemis/trunk/org.jiemamy.core/src/test/java/org/jiemamy/model/node/TableModelImplTest.java 2008-12-29 12:54:58 UTC (rev 2330) +++ artemis/trunk/org.jiemamy.core/src/test/java/org/jiemamy/model/node/TableModelImplTest.java 2008-12-29 13:03:56 UTC (rev 2331) @@ -155,10 +155,10 @@ public void test03_appendModelとremoveModel経由で各種モデルが追加削除できること() throws Exception { ColumnModel column1 = factory.newModel(ColumnModel.class); column1.setName("col1"); - column1.setDataTypeDescriptor(new IntegerDesc()); + column1.setDataType(new IntegerDesc()); ColumnModel column2 = factory.newModel(ColumnModel.class); column2.setName("col2"); - column2.setDataTypeDescriptor(new IntegerDesc()); + column2.setDataType(new IntegerDesc()); tableModel.appendModel(column1); tableModel.appendModel(column2); @@ -205,11 +205,11 @@ public void test04_モデルIDの一致により他フィールドの内容に関わらずequalsがtrueとなる() throws Exception { ColumnModel column1 = factory.newModel(ColumnModel.class); column1.setName("column1"); - column1.setDataTypeDescriptor(new IntegerDesc()); + column1.setDataType(new IntegerDesc()); ColumnModel column2 = factory.newModel(ColumnModel.class); column2.setName("column2"); - column2.setDataTypeDescriptor(new IntegerDesc()); + column2.setDataType(new IntegerDesc()); ColumnModel column3 = factory.newModel(ColumnModel.class, column1.getId()); @@ -227,10 +227,10 @@ public void test08_RootModelからのクローニングが適切に行われること() throws Exception { ColumnModel column1 = factory.newModel(ColumnModel.class); column1.setName("column1"); - column1.setDataTypeDescriptor(new IntegerDesc()); + column1.setDataType(new IntegerDesc()); ColumnModel column2 = factory.newModel(ColumnModel.class); column2.setName("column2"); - column2.setDataTypeDescriptor(new IntegerDesc()); + column2.setDataType(new IntegerDesc()); tableModel.appendModel(column1); Modified: artemis/trunk/org.jiemamy.core/src/test/java/org/jiemamy/utils/builder/ModelBuilderTest.java =================================================================== --- artemis/trunk/org.jiemamy.core/src/test/java/org/jiemamy/utils/builder/ModelBuilderTest.java 2008-12-29 12:54:58 UTC (rev 2330) +++ artemis/trunk/org.jiemamy.core/src/test/java/org/jiemamy/utils/builder/ModelBuilderTest.java 2008-12-29 13:03:56 UTC (rev 2331) @@ -82,16 +82,16 @@ emp.setName("T_EMP"); ColumnModel empId = factory.newModel(ColumnModel.class); empId.setName("ID"); - empId.setDataTypeDescriptor(new IntegerDesc(true)); + empId.setDataType(new IntegerDesc(true)); ColumnModel empName = factory.newModel(ColumnModel.class); empName.setName("NAME"); - empName.setDataTypeDescriptor(new VarcharDesc(32)); + empName.setDataType(new VarcharDesc(32)); ColumnModel empDeptId = factory.newModel(ColumnModel.class); empDeptId.setName("DEPT_ID"); - empDeptId.setDataTypeDescriptor(new IntegerDesc()); + empDeptId.setDataType(new IntegerDesc()); ColumnModel empHiredate = factory.newModel(ColumnModel.class); empHiredate.setName("HIREDATE"); - empHiredate.setDataTypeDescriptor(new TimestampDesc()); + empHiredate.setDataType(new TimestampDesc()); emp.appendModel(empId); emp.appendModel(empName); @@ -106,13 +106,13 @@ dept.setName("T_DEPT"); ColumnModel deptId = factory.newModel(ColumnModel.class); deptId.setName("ID"); - deptId.setDataTypeDescriptor(new IntegerDesc(true)); + deptId.setDataType(new IntegerDesc(true)); ColumnModel deptName = factory.newModel(ColumnModel.class); deptName.setName("NAME"); - deptName.setDataTypeDescriptor(new VarcharDesc(32)); + deptName.setDataType(new VarcharDesc(32)); ColumnModel deptLocation = factory.newModel(ColumnModel.class); deptLocation.setName("LOCATION"); - deptLocation.setDataTypeDescriptor(new VarcharDesc(16)); + deptLocation.setDataType(new VarcharDesc(16)); dept.appendModel(deptId); dept.appendModel(deptName); Modified: artemis/trunk/org.jiemamy.dialect.postgresql/src/test/java/org/jiemamy/dialect/postgresql/PostgresqlDialectTest.java =================================================================== --- artemis/trunk/org.jiemamy.dialect.postgresql/src/test/java/org/jiemamy/dialect/postgresql/PostgresqlDialectTest.java 2008-12-29 12:54:58 UTC (rev 2330) +++ artemis/trunk/org.jiemamy.dialect.postgresql/src/test/java/org/jiemamy/dialect/postgresql/PostgresqlDialectTest.java 2008-12-29 13:03:56 UTC (rev 2331) @@ -167,11 +167,11 @@ @Test public void test05_データ型のマッピングにより_相互に変換が行える() throws Exception { DataTypeResolver resolver = dialect.getDataTypeResolver(); - assertThat(resolver.resolveDataTypeDescriptor(factory, "INT"), instanceOf(IntegerDesc.class)); - assertThat(resolver.resolveDataTypeDescriptor(factory, "INT4"), instanceOf(IntegerDesc.class)); - assertThat(resolver.resolveDataTypeDescriptor(factory, "INTEGER"), instanceOf(IntegerDesc.class)); - assertThat(resolver.resolveDataTypeDescriptor(factory, "VARCHAR"), instanceOf(VarcharDesc.class)); - assertThat(resolver.resolveDataTypeDescriptor(factory, "HOGE"), instanceOf(VarcharDesc.class)); + assertThat(resolver.resolveDataType(factory, "INT"), instanceOf(IntegerDesc.class)); + assertThat(resolver.resolveDataType(factory, "INT4"), instanceOf(IntegerDesc.class)); + assertThat(resolver.resolveDataType(factory, "INTEGER"), instanceOf(IntegerDesc.class)); + assertThat(resolver.resolveDataType(factory, "VARCHAR"), instanceOf(VarcharDesc.class)); + assertThat(resolver.resolveDataType(factory, "HOGE"), instanceOf(VarcharDesc.class)); assertThat(resolver.resolveDataType(new IntegerDesc()), is("INTEGER")); } Modified: artemis/trunk/org.jiemamy.event/src/test/java/org/jiemamy/model/RootModelEventTest.java =================================================================== --- artemis/trunk/org.jiemamy.event/src/test/java/org/jiemamy/model/RootModelEventTest.java 2008-12-29 12:54:58 UTC (rev 2330) +++ artemis/trunk/org.jiemamy.event/src/test/java/org/jiemamy/model/RootModelEventTest.java 2008-12-29 13:03:56 UTC (rev 2331) @@ -97,7 +97,7 @@ TableModel tableModel = rootModel.getEntity(TableModel.class, "T_USER01"); ColumnModel columnModel = factory.newModel(ColumnModel.class); columnModel.setName("COL1"); - columnModel.setDataTypeDescriptor(new IntegerDesc()); + columnModel.setDataType(new IntegerDesc()); assertThat(tableModel, is(notNullValue())); assertThat(columnModel, is(notNullValue())); @@ -158,7 +158,7 @@ rootModel.appendModel(table2); ColumnModel columnModel = factory.newModel(ColumnModel.class); columnModel.setName("COL1"); - columnModel.setDataTypeDescriptor(new IntegerDesc()); + columnModel.setDataType(new IntegerDesc()); table1.appendModel(columnModel); // rootModelの監視を開始する。 Modified: artemis/trunk/org.jiemamy.event/src/test/java/org/jiemamy/util/ObservableListTest.java =================================================================== --- artemis/trunk/org.jiemamy.event/src/test/java/org/jiemamy/util/ObservableListTest.java 2008-12-29 12:54:58 UTC (rev 2330) +++ artemis/trunk/org.jiemamy.event/src/test/java/org/jiemamy/util/ObservableListTest.java 2008-12-29 13:03:56 UTC (rev 2331) @@ -42,7 +42,7 @@ import org.jiemamy.event.ObservableCollectionChangeEvent.Timing; import org.jiemamy.model.RootModel; import org.jiemamy.model.attribute.ColumnModel; -import org.jiemamy.model.datatype.DataTypeDescriptor; +import org.jiemamy.model.datatype.DataType; import org.jiemamy.model.datatype.IntegerDesc; import org.jiemamy.model.datatype.TimestampDesc; import org.jiemamy.model.datatype.VarcharDesc; @@ -81,7 +81,7 @@ for (int i = 0; i < columnModels.length; i++) { columnModels[i] = rootModel.getFactory().newModel(ColumnModel.class); columnModels[i].setName((String) columnDatas[i][0]); - columnModels[i].setDataTypeDescriptor((DataTypeDescriptor) columnDatas[i][1]); + columnModels[i].setDataType((DataType) columnDatas[i][1]); } return columnModels; } Modified: artemis/trunk/org.jiemamy.event/src/test/java/org/jiemamy/util/ObservableMapTest.java =================================================================== --- artemis/trunk/org.jiemamy.event/src/test/java/org/jiemamy/util/ObservableMapTest.java 2008-12-29 12:54:58 UTC (rev 2330) +++ artemis/trunk/org.jiemamy.event/src/test/java/org/jiemamy/util/ObservableMapTest.java 2008-12-29 13:03:56 UTC (rev 2331) @@ -39,7 +39,7 @@ import org.jiemamy.event.ObservableCollectionChangeEvent.Timing; import org.jiemamy.model.RootModel; import org.jiemamy.model.attribute.ColumnModel; -import org.jiemamy.model.datatype.DataTypeDescriptor; +import org.jiemamy.model.datatype.DataType; import org.jiemamy.model.datatype.IntegerDesc; import org.jiemamy.model.datatype.TimestampDesc; import org.jiemamy.model.datatype.VarcharDesc; @@ -75,7 +75,7 @@ for (int i = 0; i < columnModels.length; i++) { columnModels[i] = rootModel.getFactory().newModel(ColumnModel.class); columnModels[i].setName((String) columnDatas[i][0]); - columnModels[i].setDataTypeDescriptor((DataTypeDescriptor) columnDatas[i][1]); + columnModels[i].setDataType((DataType) columnDatas[i][1]); } return columnModels; } Modified: zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/dialect/DataTypeResolver.java =================================================================== --- zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/dialect/DataTypeResolver.java 2008-12-29 12:54:58 UTC (rev 2330) +++ zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/dialect/DataTypeResolver.java 2008-12-29 13:03:56 UTC (rev 2331) @@ -21,7 +21,7 @@ import java.util.List; import org.jiemamy.JiemamyFactory; -import org.jiemamy.model.datatype.DataTypeDescriptor; +import org.jiemamy.model.datatype.DataType; /** * データ型同士の対応関係(マッピング)を表現するクラス。 @@ -37,11 +37,11 @@ /** * 型記述子からデータ型を解決する。 - * @param dataTypeDescriptor 型記述子 + * @param dataType 型記述子 * @return 型名 * @throws IllegalArgumentException 引数に{@code null}を与えた場合 */ - String resolveDataType(DataTypeDescriptor dataTypeDescriptor); + String resolveDataType(DataType dataType); /** * 型名から型記述子を解決する。 @@ -50,5 +50,5 @@ * @return 型記述子 * @throws UnsupportedOperationException */ - DataTypeDescriptor resolveDataTypeDescriptor(JiemamyFactory factory, String typeName); + DataType resolveDataType(JiemamyFactory factory, String typeName); } Modified: zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/model/attribute/ColumnModel.java =================================================================== --- zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/model/attribute/ColumnModel.java 2008-12-29 12:54:58 UTC (rev 2330) +++ zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/model/attribute/ColumnModel.java 2008-12-29 13:03:56 UTC (rev 2331) @@ -18,7 +18,7 @@ */ package org.jiemamy.model.attribute; -import org.jiemamy.model.datatype.DataTypeDescriptor; +import org.jiemamy.model.datatype.DataType; /** * リレーショナルデータベースにおける「カラム」を表すモデルインターフェイス。 @@ -30,7 +30,7 @@ * 型記述子を取得する。 * @return 型記述子 */ - DataTypeDescriptor getDataTypeDescriptor(); + DataType getDataType(); /** * デフォルト値を取得する。 @@ -76,9 +76,9 @@ /** * 型記述子を設定する。 - * @param dataTypeDescriptor 型記述子 + * @param dataType 型記述子 */ - void setDataTypeDescriptor(DataTypeDescriptor dataTypeDescriptor); + void setDataType(DataType dataType); /** * デフォルト値を設定する。 Copied: zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/model/datatype/DataType.java (from rev 2330, zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/model/datatype/DataTypeDescriptor.java) =================================================================== --- zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/model/datatype/DataType.java (rev 0) +++ zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/model/datatype/DataType.java 2008-12-29 13:03:56 UTC (rev 2331) @@ -0,0 +1,54 @@ +/* + * Copyright 2007-2008 MIYAMOTO Daisuke, jiemamy.org and the Others. + * Created on 2008/12/10 + * + * 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.model.datatype; + +import java.sql.Types; + +import org.jiemamy.utils.Adaptable; + +/** + * 型記述子。 + * @author daisuke + */ +public interface DataType extends Adaptable { + + /** + * {@link Types}で表される型を取得する。 + * @return {@link Types}で表される型 + */ + int getSqlType(); + + /** + * TODO for daisuke + * @return + */ + String getTypeName(); + + /** + * {@link Types}で表される型を設定する。 + * @param sqlType {@link Types}で表される型 + */ + void setSqlType(int sqlType); + + /** + * TODO for daisuke + * @param typeName + */ + void setTypeName(String typeName); +} Property changes on: zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/model/datatype/DataType.java ___________________________________________________________________ Name: svn:mime-type + text/plain Modified: zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/model/datatype/DataTypeAdapter.java =================================================================== --- zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/model/datatype/DataTypeAdapter.java 2008-12-29 12:54:58 UTC (rev 2330) +++ zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/model/datatype/DataTypeAdapter.java 2008-12-29 13:03:56 UTC (rev 2331) @@ -19,7 +19,7 @@ package org.jiemamy.model.datatype; /** - * {@link DataTypeDescriptor}用のアダプタ。 + * {@link DataType}用のアダプタ。 * @author daisuke */ public interface DataTypeAdapter { Deleted: zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/model/datatype/DataTypeDescriptor.java =================================================================== --- zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/model/datatype/DataTypeDescriptor.java 2008-12-29 12:54:58 UTC (rev 2330) +++ zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/model/datatype/DataTypeDescriptor.java 2008-12-29 13:03:56 UTC (rev 2331) @@ -1,54 +0,0 @@ -/* - * Copyright 2007-2008 MIYAMOTO Daisuke, jiemamy.org and the Others. - * Created on 2008/12/10 - * - * 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.model.datatype; - -import java.sql.Types; - -import org.jiemamy.utils.Adaptable; - -/** - * 型記述子。 - * @author daisuke - */ -public interface DataTypeDescriptor extends Adaptable { - - /** - * {@link Types}で表される型を取得する。 - * @return {@link Types}で表される型 - */ - int getSqlType(); - - /** - * TODO for daisuke - * @return - */ - String getTypeName(); - - /** - * {@link Types}で表される型を設定する。 - * @param sqlType {@link Types}で表される型 - */ - void setSqlType(int sqlType); - - /** - * TODO for daisuke - * @param typeName - */ - void setTypeName(String typeName); -} Modified: zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/model/datatype/DomainModel.java =================================================================== --- zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/model/datatype/DomainModel.java 2008-12-29 12:54:58 UTC (rev 2330) +++ zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/model/datatype/DomainModel.java 2008-12-29 13:03:56 UTC (rev 2331) @@ -28,7 +28,7 @@ * ドメインを表すモデルインターフェイス。 * @author daisuke */ -public interface DomainModel extends DataTypeDescriptor, Identifiable, Adaptable { +public interface DomainModel extends DataType, Identifiable, Adaptable { /** * 制約を追加する。 @@ -52,7 +52,7 @@ * ドメインとして定義された型記述子を取得する。 * @return ドメインとして定義された型記述子 */ - DataTypeDescriptor getDataTypeDescriptor(); + DataType getDataType(); /** * デフォルト値を取得する。 @@ -104,9 +104,9 @@ /** * ドメインとして定義された型記述子を設定する。 - * @param dataTypeDescriptor ドメインとして定義された型記述子 + * @param dataType ドメインとして定義された型記述子 */ - void setDataTypeDescriptor(DataTypeDescriptor dataTypeDescriptor); + void setDataType(DataType dataType); /** * デフォルト値を設定する。 Modified: zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/xml/Nodes.java =================================================================== --- zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/xml/Nodes.java 2008-12-29 12:54:58 UTC (rev 2330) +++ zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/xml/Nodes.java 2008-12-29 13:03:56 UTC (rev 2331) @@ -48,7 +48,7 @@ public static final QName LOGICAL_NAME = new QName(Namespaces.CORE, "logicalName"); - public static final QName DATATYPE_DESC = new QName(Namespaces.CORE, "dataTypeDescriptor"); + public static final QName DATATYPE_DESC = new QName(Namespaces.CORE, "dataType"); public static final QName DEFAULT_VALUE = new QName(Namespaces.CORE, "defaultValue");