[Jiemamy-notify:2084] commit [3185] リファクタリング

アーカイブの一覧に戻る

svnno****@sourc***** svnno****@sourc*****
2009年 4月 8日 (水) 17:38:19 JST


Revision: 3185
          http://svn.sourceforge.jp/view?root=jiemamy&view=rev&rev=3185
Author:   j5ik2o
Date:     2009-04-08 17:38:19 +0900 (Wed, 08 Apr 2009)

Log Message:
-----------
リファクタリング

Modified Paths:
--------------
    charon/jiemamy-jpa-importer/trunk/src/main/java/org/jiemamy/composer/importer/DefaultJpaImportConfig.java
    charon/jiemamy-jpa-importer/trunk/src/main/java/org/jiemamy/composer/importer/DefaultTableModelConverter.java
    charon/jiemamy-jpa-importer/trunk/src/main/java/org/jiemamy/composer/importer/JpaImportConfig.java
    charon/jiemamy-jpa-importer/trunk/src/main/java/org/jiemamy/composer/importer/JpaImporter.java
    charon/jiemamy-jpa-importer/trunk/src/main/java/org/jiemamy/composer/importer/TableModelConverter.java
    charon/jiemamy-jpa-importer/trunk/src/main/java/org/jiemamy/composer/importer/meta/ColumnMeta.java
    charon/jiemamy-jpa-importer/trunk/src/main/java/org/jiemamy/composer/importer/meta/impl/ColumnMetaFactoryImpl.java
    charon/jiemamy-jpa-importer/trunk/src/main/java/org/jiemamy/composer/importer/meta/impl/PropertyMetaFactoryImpl.java
    charon/jiemamy-jpa-importer/trunk/src/test/java/example/entity/Depertment.java
    charon/jiemamy-jpa-importer/trunk/src/test/java/example/entity/Employee.java
    charon/jiemamy-jpa-importer/trunk/src/test/java/org/jiemamy/composer/importer/meta/impl/EntityMetaReaderImplTest.java

Added Paths:
-----------
    charon/jiemamy-jpa-importer/trunk/src/main/java/org/jiemamy/composer/importer/ColumnModelConverter.java
    charon/jiemamy-jpa-importer/trunk/src/main/java/org/jiemamy/composer/importer/DefaultColumnModelConverter.java


-------------- next part --------------
Added: charon/jiemamy-jpa-importer/trunk/src/main/java/org/jiemamy/composer/importer/ColumnModelConverter.java
===================================================================
--- charon/jiemamy-jpa-importer/trunk/src/main/java/org/jiemamy/composer/importer/ColumnModelConverter.java	                        (rev 0)
+++ charon/jiemamy-jpa-importer/trunk/src/main/java/org/jiemamy/composer/importer/ColumnModelConverter.java	2009-04-08 08:38:19 UTC (rev 3185)
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2007-2009 Jiemamy Project and the Others.
+ * Created on Apr 8, 2009
+ *
+ * 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.composer.importer;
+
+import org.jiemamy.composer.importer.meta.EntityMeta;
+import org.jiemamy.composer.importer.meta.PropertyMeta;
+import org.jiemamy.model.RootModel;
+import org.jiemamy.model.attribute.ColumnModel;
+import org.jiemamy.model.entity.TableModel;
+
+/**
+ * {@link ColumnModel}に変換するコンバータ。
+ * 
+ * @author j5ik2o
+ */
+public interface ColumnModelConverter {
+	
+	/**
+	 * {@link EntityMeta}から{ColumnModel}に変換する。
+	 * 
+	 * @param rootModel {@link RootModel}
+	 * @param propertyMeta {@link PropertyMeta}
+	 * @return {@link TableModel}
+	 */
+	ColumnModel convert(RootModel rootModel, PropertyMeta propertyMeta);
+}


Property changes on: charon/jiemamy-jpa-importer/trunk/src/main/java/org/jiemamy/composer/importer/ColumnModelConverter.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: charon/jiemamy-jpa-importer/trunk/src/main/java/org/jiemamy/composer/importer/DefaultColumnModelConverter.java
===================================================================
--- charon/jiemamy-jpa-importer/trunk/src/main/java/org/jiemamy/composer/importer/DefaultColumnModelConverter.java	                        (rev 0)
+++ charon/jiemamy-jpa-importer/trunk/src/main/java/org/jiemamy/composer/importer/DefaultColumnModelConverter.java	2009-04-08 08:38:19 UTC (rev 3185)
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2007-2009 Jiemamy Project and the Others.
+ * Created on Apr 8, 2009
+ *
+ * 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.composer.importer;
+
+import org.apache.commons.lang.Validate;
+
+import org.jiemamy.JiemamyFactory;
+import org.jiemamy.composer.importer.meta.PropertyMeta;
+import org.jiemamy.composer.importer.meta.PropertyMetaUtil;
+import org.jiemamy.model.RootModel;
+import org.jiemamy.model.attribute.ColumnModel;
+import org.jiemamy.model.attribute.constraint.NotNullConstraint;
+import org.jiemamy.model.attribute.constraint.PrimaryKey;
+import org.jiemamy.model.attribute.constraint.UniqueKey;
+
+/**
+ * {@link ColumnModelConverter}のデフォルト実装
+ * 
+ * @author j5ik2o
+ */
+public class DefaultColumnModelConverter implements ColumnModelConverter {
+	
+	public ColumnModel convert(RootModel rootModel, PropertyMeta propertyMeta) {
+		Validate.notNull(rootModel);
+		Validate.notNull(propertyMeta);
+		if (propertyMeta.isTransient()) {
+			return null;
+		}
+		JiemamyFactory factory = rootModel.getJiemamy().getFactory();
+		ColumnModel cm = factory.newModel(ColumnModel.class);
+		cm.setName(propertyMeta.getColumnMeta().getName());
+		cm.setLogicalName(PropertyMetaUtil.getComment(propertyMeta));
+		if (propertyMeta.isId()) {
+			cm.setPrimaryKey(factory.newModel(PrimaryKey.class));
+		}
+		if (propertyMeta.getColumnMeta().isNullable() == false) {
+			cm.setNotNullConstraint(factory.newModel(NotNullConstraint.class));
+		}
+		if (propertyMeta.getColumnMeta().isUnique()) {
+			cm.setUniqueKey(factory.newModel(UniqueKey.class));
+		}
+		//TODO cm.setDataType(dataType);
+		//TODO cm.setDefaultValue(defaultValue);
+		return cm;
+	}
+}


Property changes on: charon/jiemamy-jpa-importer/trunk/src/main/java/org/jiemamy/composer/importer/DefaultColumnModelConverter.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Modified: charon/jiemamy-jpa-importer/trunk/src/main/java/org/jiemamy/composer/importer/DefaultJpaImportConfig.java
===================================================================
--- charon/jiemamy-jpa-importer/trunk/src/main/java/org/jiemamy/composer/importer/DefaultJpaImportConfig.java	2009-04-08 06:51:33 UTC (rev 3184)
+++ charon/jiemamy-jpa-importer/trunk/src/main/java/org/jiemamy/composer/importer/DefaultJpaImportConfig.java	2009-04-08 08:38:19 UTC (rev 3185)
@@ -45,11 +45,17 @@
 	
 	private TableModelConverter tableModelConverter;
 	
+	private ColumnModelConverter columnModelConverter;
+	
 
 	public List<String> getClassPathDirs() {
 		return classPathDirs;
 	}
 	
+	public ColumnModelConverter getColumnModelConverter() {
+		return columnModelConverter;
+	}
+	
 	public List<String> getEntityClassNamePatterns() {
 		return entityClassNamePatterns;
 	}
@@ -101,6 +107,15 @@
 	}
 	
 	/**
+	 * {@link ColumnModelConverter}を設定する。
+	 * 
+	 * @param columnModelConverter {@link ColumnModelConverter}
+	 */
+	public void setColumnModelConverter(ColumnModelConverter columnModelConverter) {
+		this.columnModelConverter = columnModelConverter;
+	}
+	
+	/**
 	 * 採用するエンティティクラス名のパターンを設定する。
 	 * 
 	 * @param entityClassNamePatterns 採用するエンティティクラス名のパターンのリスト

Modified: charon/jiemamy-jpa-importer/trunk/src/main/java/org/jiemamy/composer/importer/DefaultTableModelConverter.java
===================================================================
--- charon/jiemamy-jpa-importer/trunk/src/main/java/org/jiemamy/composer/importer/DefaultTableModelConverter.java	2009-04-08 06:51:33 UTC (rev 3184)
+++ charon/jiemamy-jpa-importer/trunk/src/main/java/org/jiemamy/composer/importer/DefaultTableModelConverter.java	2009-04-08 08:38:19 UTC (rev 3185)
@@ -18,6 +18,8 @@
  */
 package org.jiemamy.composer.importer;
 
+import org.apache.commons.lang.Validate;
+
 import org.jiemamy.composer.importer.meta.EntityMeta;
 import org.jiemamy.model.RootModel;
 import org.jiemamy.model.entity.TableModel;
@@ -30,9 +32,11 @@
 public class DefaultTableModelConverter implements TableModelConverter {
 	
 	public TableModel convert(RootModel rootModel, EntityMeta entityMeta) {
-		// TODO ちゃんと組む
+		Validate.notNull(rootModel);
+		Validate.notNull(entityMeta);
 		TableModel tm = rootModel.getJiemamy().getFactory().newModel(TableModel.class);
 		tm.setName(entityMeta.getName());
+		tm.setLogicalName(entityMeta.getTableMeta().getName());
 		return tm;
 	}
 	

Modified: charon/jiemamy-jpa-importer/trunk/src/main/java/org/jiemamy/composer/importer/JpaImportConfig.java
===================================================================
--- charon/jiemamy-jpa-importer/trunk/src/main/java/org/jiemamy/composer/importer/JpaImportConfig.java	2009-04-08 06:51:33 UTC (rev 3184)
+++ charon/jiemamy-jpa-importer/trunk/src/main/java/org/jiemamy/composer/importer/JpaImportConfig.java	2009-04-08 08:38:19 UTC (rev 3185)
@@ -37,6 +37,13 @@
 	List<String> getClassPathDirs();
 	
 	/**
+	 * {@link ColumnModelConverter}を取得する。
+	 * 
+	 * @return {@link ColumnModelConverter}
+	 */
+	ColumnModelConverter getColumnModelConverter();
+	
+	/**
 	 * 採用するエンティティクラス名のパターンを取得する。
 	 * 
 	 * @return エンティティクラス名のパターン

Modified: charon/jiemamy-jpa-importer/trunk/src/main/java/org/jiemamy/composer/importer/JpaImporter.java
===================================================================
--- charon/jiemamy-jpa-importer/trunk/src/main/java/org/jiemamy/composer/importer/JpaImporter.java	2009-04-08 06:51:33 UTC (rev 3184)
+++ charon/jiemamy-jpa-importer/trunk/src/main/java/org/jiemamy/composer/importer/JpaImporter.java	2009-04-08 08:38:19 UTC (rev 3185)
@@ -30,12 +30,14 @@
 import org.jiemamy.composer.importer.meta.EntityMeta;
 import org.jiemamy.composer.importer.meta.EntityMetaReader;
 import org.jiemamy.composer.importer.meta.EntityMetaReaderContext;
+import org.jiemamy.composer.importer.meta.PropertyMeta;
 import org.jiemamy.composer.importer.meta.impl.ColumnMetaFactoryImpl;
 import org.jiemamy.composer.importer.meta.impl.EntityMetaFactoryImpl;
 import org.jiemamy.composer.importer.meta.impl.EntityMetaReaderImpl;
 import org.jiemamy.composer.importer.meta.impl.PropertyMetaFactoryImpl;
 import org.jiemamy.composer.importer.meta.impl.TableMetaFactoryImpl;
 import org.jiemamy.model.RootModel;
+import org.jiemamy.model.attribute.ColumnModel;
 import org.jiemamy.model.entity.TableModel;
 import org.jiemamy.utils.ClassUtil;
 import org.jiemamy.utils.CollectionsUtil;
@@ -55,7 +57,22 @@
 	
 	private static final TableModelConverter DEFALUT_TABLE_CONVETER = new DefaultTableModelConverter();
 	
+	private static final ColumnModelConverter DEFALUT_COLUMN_CONVETER = new DefaultColumnModelConverter();
+	
 
+	/**
+	 * {@link ColumnModelConverter}を取得する。
+	 * 
+	 * @param config {@link JpaImportConfig}
+	 * @return {@link ColumnModelConverter}
+	 */
+	protected ColumnModelConverter getColumnModelConverter(JpaImportConfig config) {
+		if (config.getColumnModelConverter() != null) {
+			return config.getColumnModelConverter();
+		}
+		return DEFALUT_COLUMN_CONVETER;
+	}
+	
 	public String getName() {
 		return IMPORTER_NAME;
 	}
@@ -100,11 +117,16 @@
 		
 		try {
 			List<EntityMeta> entityMetas = entityMetaReader.read();
-			TableModelConverter tbc = getTableModelConverter(config);
+			TableModelConverter tmc = getTableModelConverter(config);
+			ColumnModelConverter cmc = getColumnModelConverter(config);
 			for (EntityMeta em : entityMetas) {
 				LOG.debug(LogMarker.DETAIL, em.toString());
-				TableModel tm = tbc.convert(rootModel, em);
+				TableModel tm = tmc.convert(rootModel, em);
 				rootModel.getEntities().add(tm);
+				for (PropertyMeta pm : em.getAllColumnPropertyMeta()) {
+					ColumnModel cm = cmc.convert(rootModel, pm);
+					tm.getAttributes().add(cm);
+				}
 			}
 		} catch (IOException e) {
 			throw new ImportException(e);

Modified: charon/jiemamy-jpa-importer/trunk/src/main/java/org/jiemamy/composer/importer/TableModelConverter.java
===================================================================
--- charon/jiemamy-jpa-importer/trunk/src/main/java/org/jiemamy/composer/importer/TableModelConverter.java	2009-04-08 06:51:33 UTC (rev 3184)
+++ charon/jiemamy-jpa-importer/trunk/src/main/java/org/jiemamy/composer/importer/TableModelConverter.java	2009-04-08 08:38:19 UTC (rev 3185)
@@ -23,7 +23,7 @@
 import org.jiemamy.model.entity.TableModel;
 
 /**
- * {@TableModel}に変換するコンバータです。
+ * {@link TableModel}に変換するコンバータ。
  * 
  * @author j5ik2o
  */

Modified: charon/jiemamy-jpa-importer/trunk/src/main/java/org/jiemamy/composer/importer/meta/ColumnMeta.java
===================================================================
--- charon/jiemamy-jpa-importer/trunk/src/main/java/org/jiemamy/composer/importer/meta/ColumnMeta.java	2009-04-08 06:51:33 UTC (rev 3184)
+++ charon/jiemamy-jpa-importer/trunk/src/main/java/org/jiemamy/composer/importer/meta/ColumnMeta.java	2009-04-08 08:38:19 UTC (rev 3185)
@@ -36,8 +36,27 @@
 	/** 更新可能フラグ */
 	private boolean updatable = true;
 	
+	/** NULL許可制約 */
+	private boolean nullable = true;
+	
+	/** ユニーク制約 */
+	private boolean unique = false;
+	
+	private Integer length;
+	
+	private Integer precision;
+	
 
 	/**
+	 * カラムのサイズを取得する。
+	 * 
+	 * @return カラムのサイズ
+	 */
+	public Integer getLength() {
+		return length;
+	}
+	
+	/**
 	 * 名前を取得する。
 	 * 
 	 * @return 名前
@@ -47,6 +66,15 @@
 	}
 	
 	/**
+	 * 精度を取得する。
+	 * 
+	 * @return 精度
+	 */
+	public Integer getPrecision() {
+		return precision;
+	}
+	
+	/**
 	 * 挿入可能フラグを取得する。
 	 * 
 	 * @return trueの場合は挿入可能
@@ -56,6 +84,24 @@
 	}
 	
 	/**
+	 * NULL許可制約を取得する。
+	 * 
+	 * @return NULL許可制約
+	 */
+	public boolean isNullable() {
+		return nullable;
+	}
+	
+	/**
+	 * ユニーク制約を取得する。
+	 * 
+	 * @return ユニーク制約
+	 */
+	public boolean isUnique() {
+		return unique;
+	}
+	
+	/**
 	 * 更新可能フラグを返します。
 	 * 
 	 * @return trueの場合は更新可能
@@ -74,6 +120,15 @@
 	}
 	
 	/**
+	 * カラムのサイズを設定する。
+	 * 
+	 * @param length カラムのサイズ
+	 */
+	public void setLength(Integer length) {
+		this.length = length;
+	}
+	
+	/**
 	 * 名前を設定する。
 	 * 
 	 * @param name 名前
@@ -83,6 +138,33 @@
 	}
 	
 	/**
+	 * NULL許可制約を設定する。
+	 * 
+	 * @param nullable NULL許可制約
+	 */
+	public void setNullable(boolean nullable) {
+		this.nullable = nullable;
+	}
+	
+	/**
+	 * 精度を設定する。
+	 * 
+	 * @param precision 精度
+	 */
+	public void setPrecision(Integer precision) {
+		this.precision = precision;
+	}
+	
+	/**
+	 * ユニーク制約を設定する。
+	 * 
+	 * @param unique ユニーク制約
+	 */
+	public void setUnique(boolean unique) {
+		this.unique = unique;
+	}
+	
+	/**
 	 * 更新可能フラグを設定する。
 	 * 
 	 * @param updatable 更新可能フラグ

Modified: charon/jiemamy-jpa-importer/trunk/src/main/java/org/jiemamy/composer/importer/meta/impl/ColumnMetaFactoryImpl.java
===================================================================
--- charon/jiemamy-jpa-importer/trunk/src/main/java/org/jiemamy/composer/importer/meta/impl/ColumnMetaFactoryImpl.java	2009-04-08 06:51:33 UTC (rev 3184)
+++ charon/jiemamy-jpa-importer/trunk/src/main/java/org/jiemamy/composer/importer/meta/impl/ColumnMetaFactoryImpl.java	2009-04-08 08:38:19 UTC (rev 3185)
@@ -53,6 +53,10 @@
 			columnMeta.setName(name);
 			columnMeta.setInsertable(column.insertable());
 			columnMeta.setUpdatable(column.updatable());
+			columnMeta.setNullable(column.nullable());
+			columnMeta.setUnique(column.unique());
+			columnMeta.setLength(column.length() > 0 ? column.length() : null);
+			columnMeta.setPrecision(column.precision() > 0 ? column.precision() : null);
 		} else {
 			columnMeta.setName(defaultName);
 		}

Modified: charon/jiemamy-jpa-importer/trunk/src/main/java/org/jiemamy/composer/importer/meta/impl/PropertyMetaFactoryImpl.java
===================================================================
--- charon/jiemamy-jpa-importer/trunk/src/main/java/org/jiemamy/composer/importer/meta/impl/PropertyMetaFactoryImpl.java	2009-04-08 06:51:33 UTC (rev 3184)
+++ charon/jiemamy-jpa-importer/trunk/src/main/java/org/jiemamy/composer/importer/meta/impl/PropertyMetaFactoryImpl.java	2009-04-08 08:38:19 UTC (rev 3185)
@@ -89,10 +89,10 @@
 	
 
 	/**
-	 * インスタンスを生成する。
-	 * 
-	 * @param columnMetaFactory {@link ColumnMetaFactory}
-	 */
+	* インスタンスを生成する。
+	* 
+	* @param columnMetaFactory {@link ColumnMetaFactory}
+	*/
 	public PropertyMetaFactoryImpl(ColumnMetaFactory columnMetaFactory) {
 		Validate.notNull(columnMetaFactory);
 		this.columnMetaFactory = columnMetaFactory;
@@ -179,7 +179,7 @@
 		Validate.notNull(field);
 		Validate.notNull(entityMeta);
 		propertyMeta.setField(field);
-		propertyMeta.setPropertyClass(field.getDeclaringClass());
+		propertyMeta.setPropertyClass(field.getType());
 	}
 	
 	private void doId(PropertyMeta propertyMeta, Field field, EntityMeta entityMeta)

Modified: charon/jiemamy-jpa-importer/trunk/src/test/java/example/entity/Depertment.java
===================================================================
--- charon/jiemamy-jpa-importer/trunk/src/test/java/example/entity/Depertment.java	2009-04-08 06:51:33 UTC (rev 3184)
+++ charon/jiemamy-jpa-importer/trunk/src/test/java/example/entity/Depertment.java	2009-04-08 08:38:19 UTC (rev 3185)
@@ -18,6 +18,7 @@
  */
 package example.entity;
 
+import javax.persistence.Column;
 import javax.persistence.Entity;
 import javax.persistence.Id;
 import javax.persistence.Version;
@@ -37,10 +38,12 @@
 	private Long depertmentId;
 	
 	/** 部署名 */
+	@Column(nullable = false)
 	private String depertmentName;
 	
 	/** バージョン */
 	@Version
+	@Column(nullable = false)
 	private Long version;
 	
 

Modified: charon/jiemamy-jpa-importer/trunk/src/test/java/example/entity/Employee.java
===================================================================
--- charon/jiemamy-jpa-importer/trunk/src/test/java/example/entity/Employee.java	2009-04-08 06:51:33 UTC (rev 3184)
+++ charon/jiemamy-jpa-importer/trunk/src/test/java/example/entity/Employee.java	2009-04-08 08:38:19 UTC (rev 3185)
@@ -18,6 +18,7 @@
  */
 package example.entity;
 
+import javax.persistence.Column;
 import javax.persistence.Entity;
 import javax.persistence.Id;
 import javax.persistence.JoinColumn;
@@ -37,13 +38,16 @@
 	private Long employeeId;
 	
 	/** 従業員名 */
+	@Column(nullable = false)
 	private String employeeName;
 	
 	/** 部署ID */
+	@Column(nullable = false)
 	private Long depertmentId;
 	
 	/** バージョン */
 	@Version
+	@Column(nullable = false)
 	private Long version;
 	
 	@ManyToOne

Modified: charon/jiemamy-jpa-importer/trunk/src/test/java/org/jiemamy/composer/importer/meta/impl/EntityMetaReaderImplTest.java
===================================================================
--- charon/jiemamy-jpa-importer/trunk/src/test/java/org/jiemamy/composer/importer/meta/impl/EntityMetaReaderImplTest.java	2009-04-08 06:51:33 UTC (rev 3184)
+++ charon/jiemamy-jpa-importer/trunk/src/test/java/org/jiemamy/composer/importer/meta/impl/EntityMetaReaderImplTest.java	2009-04-08 08:38:19 UTC (rev 3185)
@@ -100,6 +100,18 @@
 		assertThat(em.getPropertyMeta("depertmentId").getName(), is("depertmentId"));
 		assertThat(em.getPropertyMeta("depertmentName").getName(), is("depertmentName"));
 		assertThat(em.getPropertyMeta("version").getName(), is("version"));
+		// property class null check
+		assertThat(em.getPropertyMeta("depertmentId").getPropertyClass(), is(notNullValue()));
+		assertThat(em.getPropertyMeta("depertmentName").getPropertyClass(), is(notNullValue()));
+		assertThat(em.getPropertyMeta("version").getPropertyClass(), is(notNullValue()));
+		// property class name null check
+		assertThat(em.getPropertyMeta("depertmentId").getPropertyClass().getName(), is(notNullValue()));
+		assertThat(em.getPropertyMeta("depertmentName").getPropertyClass().getName(), is(notNullValue()));
+		assertThat(em.getPropertyMeta("version").getPropertyClass().getName(), is(notNullValue()));
+		// property class name equal check
+		assertThat(em.getPropertyMeta("depertmentId").getPropertyClass().getName(), is("java.lang.Long"));
+		assertThat(em.getPropertyMeta("depertmentName").getPropertyClass().getName(), is("java.lang.String"));
+		assertThat(em.getPropertyMeta("version").getPropertyClass().getName(), is("java.lang.Long"));
 		// column name null check
 		assertThat(em.getPropertyMeta("depertmentId").getColumnMeta().getName(), is(notNullValue()));
 		assertThat(em.getPropertyMeta("depertmentName").getColumnMeta().getName(), is(notNullValue()));
@@ -108,6 +120,7 @@
 		assertThat(em.getPropertyMeta("depertmentId").getColumnMeta().getName(), is("DEPERTMENT_ID"));
 		assertThat(em.getPropertyMeta("depertmentName").getColumnMeta().getName(), is("DEPERTMENT_NAME"));
 		assertThat(em.getPropertyMeta("version").getColumnMeta().getName(), is("VERSION"));
+		
 		// property attribute check
 		assertThat(em.getPropertyMeta("depertmentId").isId(), is(true));
 		assertThat(em.getPropertyMeta("version").isVersion(), is(true));
@@ -141,6 +154,18 @@
 		assertThat(em.getPropertyMeta("employeeId").getName(), is("employeeId"));
 		assertThat(em.getPropertyMeta("employeeName").getName(), is("employeeName"));
 		assertThat(em.getPropertyMeta("version").getName(), is("version"));
+		// property class null check
+		assertThat(em.getPropertyMeta("employeeId").getPropertyClass(), is(notNullValue()));
+		assertThat(em.getPropertyMeta("employeeName").getPropertyClass(), is(notNullValue()));
+		assertThat(em.getPropertyMeta("version").getPropertyClass(), is(notNullValue()));
+		// property class name null check
+		assertThat(em.getPropertyMeta("employeeId").getPropertyClass().getName(), is(notNullValue()));
+		assertThat(em.getPropertyMeta("employeeName").getPropertyClass().getName(), is(notNullValue()));
+		assertThat(em.getPropertyMeta("version").getPropertyClass().getName(), is(notNullValue()));
+		// property class name equal check
+		assertThat(em.getPropertyMeta("employeeId").getPropertyClass().getName(), is("java.lang.Long"));
+		assertThat(em.getPropertyMeta("employeeName").getPropertyClass().getName(), is("java.lang.String"));
+		assertThat(em.getPropertyMeta("version").getPropertyClass().getName(), is("java.lang.Long"));
 		// column name null check
 		assertThat(em.getPropertyMeta("employeeId").getColumnMeta().getName(), is(notNullValue()));
 		assertThat(em.getPropertyMeta("employeeName").getColumnMeta().getName(), is(notNullValue()));



Jiemamy-notify メーリングリストの案内
アーカイブの一覧に戻る