svnno****@sourc*****
svnno****@sourc*****
2009年 4月 15日 (水) 16:01:29 JST
Revision: 3289 http://svn.sourceforge.jp/view?root=jiemamy&view=rev&rev=3289 Author: j5ik2o Date: 2009-04-15 16:01:29 +0900 (Wed, 15 Apr 2009) Log Message: ----------- NamingConventionを適用 Modified Paths: -------------- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/desc/impl/EntityDescSetWriterImpl.java leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/impl/AssociationModelFactoryImpl.java leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/impl/AttributeModelFactoryImpl.java -------------- next part -------------- Modified: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/desc/impl/EntityDescSetWriterImpl.java =================================================================== --- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/desc/impl/EntityDescSetWriterImpl.java 2009-04-15 06:19:10 UTC (rev 3288) +++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/desc/impl/EntityDescSetWriterImpl.java 2009-04-15 07:01:29 UTC (rev 3289) @@ -81,14 +81,16 @@ if (persistenceConvention == null) { persistenceConvention = new PersistenceConventionImpl(); } - entityModelFactory = createEntityModelFactory(entityDescSetWriterContext); + entityModelFactory = createEntityModelFactory(entityDescSetWriterContext, persistenceConvention); entitySetDescFactory = createEntitySetDescFactory(entityDescSetWriterContext, persistenceConvention); } - private EntityModelFactory createEntityModelFactory(EntityDescSetWriterContext entityDescSetWriterContext) { + private EntityModelFactory createEntityModelFactory(EntityDescSetWriterContext entityDescSetWriterContext, + PersistenceConvention persistenceConvention) { AttributeModelFactory attributeModelFactory = - new AttributeModelFactoryImpl(entityDescSetWriterContext.isShowColumnName(), entityDescSetWriterContext - .isShowColumnDefinition(), entityDescSetWriterContext.isUseTemporalType()); + new AttributeModelFactoryImpl(persistenceConvention, entityDescSetWriterContext.isShowColumnName(), + entityDescSetWriterContext.isShowColumnDefinition(), entityDescSetWriterContext + .isUseTemporalType()); AssociationModelFactory associationModelFactory = new AssociationModelFactoryImpl(entityDescSetWriterContext.isShowJoinColumn()); CompositeUniqueConstraintModelFactory compositeUniqueConstraintModelFactory = Modified: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/impl/AssociationModelFactoryImpl.java =================================================================== --- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/impl/AssociationModelFactoryImpl.java 2009-04-15 06:19:10 UTC (rev 3288) +++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/impl/AssociationModelFactoryImpl.java 2009-04-15 07:01:29 UTC (rev 3289) @@ -27,7 +27,7 @@ import org.jiemamy.entity.io.gen.model.JoinColumnsModel; /** - * {@link AssociationModelFactory}の実装クラスです。 + * {@link AssociationModelFactory}の実装クラス。 * * @author j5ik2o */ @@ -40,8 +40,7 @@ /** * インスタンスを構築する。 * - * @param showJoinColumn - * {@link JoinColumn}を表示する場合{@code true} + * @param showJoinColumn {@link JoinColumn}を表示する場合{@code true} */ public AssociationModelFactoryImpl(boolean showJoinColumn) { this.showJoinColumn = showJoinColumn; @@ -50,10 +49,8 @@ /** * 結合カラムモデルを処理する。 * - * @param associationModel - * 関連モデル - * @param associationDesc - * 関連記述 + * @param associationModel 関連モデル + * @param associationDesc 関連記述 */ protected void doJoinColumnModel(AssociationModel associationModel, AssociationDesc associationDesc) { String propertyName = associationDesc.getName(); @@ -70,10 +67,8 @@ /** * 複合結合カラムモデルを処理する。 * - * @param associationModel - * 関連モデル - * @param associationDesc - * 関連記述 + * @param associationModel 関連モデル + * @param associationDesc 関連記述 */ protected void doJoinColumnsModel(AssociationModel associationModel, AssociationDesc associationDesc) { JoinColumnsModel joinColumnsModel = new JoinColumnsModel(); @@ -111,12 +106,9 @@ /** * 結合カラムのデフォルトのマッピングルールに合致する場合{@code true}を取得する。 * - * @param propertyName - * プロパティ名 - * @param columnName - * 参照する側のカラム名 - * @param referencedColumnName - * 参照される側のカラム名 + * @param propertyName プロパティ名 + * @param columnName 参照する側のカラム名 + * @param referencedColumnName 参照される側のカラム名 * @return 結合カラムの命名規約に合致する場合{@code true} */ protected boolean matchesDefaultMappingRule(String propertyName, String columnName, String referencedColumnName) { Modified: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/impl/AttributeModelFactoryImpl.java =================================================================== --- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/impl/AttributeModelFactoryImpl.java 2009-04-15 06:19:10 UTC (rev 3288) +++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/impl/AttributeModelFactoryImpl.java 2009-04-15 07:01:29 UTC (rev 3289) @@ -23,11 +23,11 @@ import javax.persistence.TemporalType; +import org.jiemamy.entity.io.convensition.PersistenceConvention; import org.jiemamy.entity.io.gen.desc.AttributeDesc; import org.jiemamy.entity.io.gen.model.AttributeModel; import org.jiemamy.entity.io.gen.model.AttributeModelFactory; import org.jiemamy.utils.ClassUtil; -import org.jiemamy.utils.StringUtil; /** * {@link AttributeModelFactory}の実装クラス。 @@ -45,20 +45,21 @@ /** {@link TemporalType}を使用する場合{@code true} */ protected boolean useTemporalType; + /** 永続化層の命名規約 */ + protected PersistenceConvention persistenceConvention; + /** - * インスタンスを構築する。 + * インスタンスを生成する。 * - * @param showColumnName - * カラム名を表示する場合{@code true} - * @param showColumnDefinition - * カラム定義を表示する場合{@code true} - * @param useTemporalType - * {@link TemporalType}を使用する場合{@code true} - * @param persistenceConvention - * 永続化層の命名規約 + * @param persistenceConvention 永続化層の命名規約 + * @param showColumnName カラム名を表示する場合{@code true} + * @param showColumnDefinition カラム定義を表示する場合{@code true} + * @param useTemporalType {@link TemporalType}を使用する場合{@code true} */ - public AttributeModelFactoryImpl(boolean showColumnName, boolean showColumnDefinition, boolean useTemporalType) { + public AttributeModelFactoryImpl(PersistenceConvention persistenceConvention, boolean showColumnName, + boolean showColumnDefinition, boolean useTemporalType) { + this.persistenceConvention = persistenceConvention; this.showColumnName = showColumnName; this.showColumnDefinition = showColumnDefinition; this.useTemporalType = useTemporalType; @@ -82,10 +83,8 @@ /** * カラム定義を処理する。 * - * @param attributeModel - * 属性モデル - * @param attributeDesc - * 属性記述 + * @param attributeModel 属性モデル + * @param attributeDesc 属性記述 */ protected void doColumnDefinition(AttributeModel attributeModel, AttributeDesc attributeDesc) { attributeModel.setColumnDefinition(attributeDesc.getColumnDefinition()); @@ -95,14 +94,12 @@ /** * カラム名を処理する。 * - * @param attributeModel - * 属性モデル - * @param attributeDesc - * 属性記述 + * @param attributeModel 属性モデル + * @param attributeDesc 属性記述 */ protected void doColumnName(AttributeModel attributeModel, AttributeDesc attributeDesc) { String realColumnName = attributeDesc.getColumnName(); - String convertedColumnName = fromPropertyNameToColumnName(attributeModel.getName()); + String convertedColumnName = persistenceConvention.fromPropertyNameToColumnName(attributeModel.getName()); if (showColumnName || !realColumnName.equalsIgnoreCase(convertedColumnName)) { attributeModel.setColumnName(realColumnName); } @@ -111,10 +108,8 @@ /** * 長さを処理する。 * - * @param attributeModel - * 属性モデル - * @param attributeDesc - * 属性記述 + * @param attributeModel 属性モデル + * @param attributeDesc 属性記述 */ protected void doLength(AttributeModel attributeModel, AttributeDesc attributeDesc) { if (attributeDesc.getLength() < 1) { @@ -130,10 +125,8 @@ /** * 精度を処理する。 * - * @param attributeModel - * 属性モデル - * @param attributeDesc - * 属性記述 + * @param attributeModel 属性モデル + * @param attributeDesc 属性記述 */ protected void doPrecision(AttributeModel attributeModel, AttributeDesc attributeDesc) { if (attributeDesc.getPrecision() < 1) { @@ -148,10 +141,8 @@ /** * スケールを処理する。 * - * @param attributeModel - * 属性モデル - * @param attributeDesc - * 属性記述 + * @param attributeModel 属性モデル + * @param attributeDesc 属性記述 */ protected void doScale(AttributeModel attributeModel, AttributeDesc attributeDesc) { if (attributeDesc.getScale() < 1) { @@ -163,10 +154,6 @@ } } - private String fromPropertyNameToColumnName(String name) { - return StringUtil.decamelize(name); - } - public AttributeModel getAttributeModel(AttributeDesc attributeDesc) { AttributeModel attributeModel = new AttributeModel(); attributeModel.setName(attributeDesc.getName());