svnno****@sourc*****
svnno****@sourc*****
2009年 4月 30日 (木) 08:09:44 JST
Revision: 3336 http://svn.sourceforge.jp/view?root=jiemamy&view=rev&rev=3336 Author: daisuke_m Date: 2009-04-30 08:09:43 +0900 (Thu, 30 Apr 2009) Log Message: ----------- getter風のロジック付きメソッドの名称を変更。 Modified Paths: -------------- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/model/RootModelImpl.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/model/attribute/AbstractAttributeModel.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/model/attribute/ColumnModelImpl.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/model/attribute/constraint/ForeignKeyImpl.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/model/entity/AbstractEntityModel.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/model/entity/TableModelImpl.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/AttributeUtil.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/ColumnUtil.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/EntityUtil.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/ForeignKeyUtil.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/RootModelUtil.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/TableUtil.java artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/JiemamyPropertyTest.java leto/jiemamy-commons/trunk/src/main/java/org/jiemamy/utils/ReflectionUtil.java zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/RootModel.java zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/attribute/AttributeModel.java zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/attribute/ColumnModel.java zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/attribute/constraint/ForeignKey.java zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/entity/EntityModel.java zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/entity/TableModel.java -------------- next part -------------- Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/model/RootModelImpl.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/model/RootModelImpl.java 2009-04-28 03:01:56 UTC (rev 3335) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/model/RootModelImpl.java 2009-04-29 23:09:43 UTC (rev 3336) @@ -105,7 +105,7 @@ return description; } - public Dialect getDialect() throws ClassNotFoundException { + public Dialect findDialect() throws ClassNotFoundException { // TODO インライン展開 return RootModelUtil.getDialect(this); } Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/model/attribute/AbstractAttributeModel.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/model/attribute/AbstractAttributeModel.java 2009-04-28 03:01:56 UTC (rev 3335) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/model/attribute/AbstractAttributeModel.java 2009-04-29 23:09:43 UTC (rev 3336) @@ -54,7 +54,7 @@ super(jiemamy, id); } - public TableModel getDeclaringTable() { + public TableModel findDeclaringTable() { // TODO インライン展開 return AttributeUtil.getDefinedTable(this); } Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/model/attribute/ColumnModelImpl.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/model/attribute/ColumnModelImpl.java 2009-04-28 03:01:56 UTC (rev 3335) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/model/attribute/ColumnModelImpl.java 2009-04-29 23:09:43 UTC (rev 3336) @@ -87,7 +87,7 @@ return uniqueKey; } - public boolean isPrimaryKeyColumn() { + public boolean checkPrimaryKeyColumn() { // TODO インライン展開 return ColumnUtil.isPartOfPrimaryKeyColumns(this); } Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/model/attribute/constraint/ForeignKeyImpl.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/model/attribute/constraint/ForeignKeyImpl.java 2009-04-28 03:01:56 UTC (rev 3335) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/model/attribute/constraint/ForeignKeyImpl.java 2009-04-29 23:09:43 UTC (rev 3336) @@ -75,12 +75,12 @@ return referenceColumns; } - public EntityModel getReferencedEntity() { + public EntityModel findReferencedEntity() { // TODO インライン展開 return ForeignKeyUtil.getReferenceEntity(this); } - public KeyConstraint getReferencedKeyConstraint() { + public KeyConstraint findReferencedKeyConstraint() { // TODO インライン展開 return ForeignKeyUtil.getReferenceKeyConstraint(this); } Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/model/entity/AbstractEntityModel.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/model/entity/AbstractEntityModel.java 2009-04-28 03:01:56 UTC (rev 3335) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/model/entity/AbstractEntityModel.java 2009-04-29 23:09:43 UTC (rev 3336) @@ -80,12 +80,12 @@ return name; } - public Collection<EntityModel> getSubEntities(boolean recursive) { + public Collection<EntityModel> findSubEntities(boolean recursive) { // TODO インライン展開 return EntityUtil.getDependentEntities(this, recursive); } - public Collection<EntityModel> getSuperEntities(boolean recursive) { + public Collection<EntityModel> findSuperEntities(boolean recursive) { // TODO インライン展開 return EntityUtil.getReferenceEntities(this, recursive); } Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/model/entity/TableModelImpl.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/model/entity/TableModelImpl.java 2009-04-28 03:01:56 UTC (rev 3335) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/model/entity/TableModelImpl.java 2009-04-29 23:09:43 UTC (rev 3336) @@ -82,12 +82,12 @@ return TableUtil.getColumn(this, columnName); } - public List<ColumnModel> getColumns() { + public List<ColumnModel> findColumns() { // TODO インライン展開 return TableUtil.getColumns(this); } - public List<ForeignKey> getForeignKeys() { + public List<ForeignKey> findForeignKeys() { return getAttributes(ForeignKey.class); } @@ -96,7 +96,7 @@ return indexes; } - public PrimaryKey getPrimaryKey() { + public PrimaryKey findPrimaryKey() { // TODO インライン展開 return TableUtil.getPrimaryKey(this); } Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/AttributeUtil.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/AttributeUtil.java 2009-04-28 03:01:56 UTC (rev 3335) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/AttributeUtil.java 2009-04-29 23:09:43 UTC (rev 3336) @@ -90,7 +90,7 @@ * @param attribute 対象属性モデル * @return この属性が所属するテーブル. どのテーブルにも所属していない場合は{@code null} * @throws IllegalArgumentException 引数に{@code null}を与えた場合 - * @deprecated use {@link AttributeModel#getDeclaringTable()} + * @deprecated use {@link AttributeModel#findDeclaringTable()} */ @Deprecated public static TableModel getDefinedTable(AttributeModel attribute) { Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/ColumnUtil.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/ColumnUtil.java 2009-04-28 03:01:56 UTC (rev 3335) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/ColumnUtil.java 2009-04-29 23:09:43 UTC (rev 3336) @@ -45,7 +45,7 @@ * @param columnModel 対象カラム * @return 主キー制約構成カラムである場合は{@code true}、そうでない場合は{@code false} * @throws IllegalArgumentException 引数に{@code null}を与えた場合 - * @deprecated use {@link ColumnModel#isPrimaryKeyColumn()} + * @deprecated use {@link ColumnModel#checkPrimaryKeyColumn()} */ @Deprecated public static boolean isPartOfPrimaryKeyColumns(ColumnModel columnModel) { Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/EntityUtil.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/EntityUtil.java 2009-04-28 03:01:56 UTC (rev 3335) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/EntityUtil.java 2009-04-29 23:09:43 UTC (rev 3336) @@ -88,7 +88,7 @@ * @param recursive 再帰的に検索する場合は{@code true}、そうでない場合は{@code false} * @return エンティティの集合 * @throws IllegalArgumentException 引数に{@code null}を与えた場合 - * @deprecated use {@link EntityModel#getSubEntities(boolean)} + * @deprecated use {@link EntityModel#findSubEntities(boolean)} */ @Deprecated public static Collection<EntityModel> getDependentEntities(EntityModel entityModel, boolean recursive) { @@ -103,7 +103,7 @@ * @param recursive 再帰的に検索する場合は{@code true}、そうでない場合は{@code false} * @return エンティティの集合 * @throws IllegalArgumentException 引数に{@code null}を与えた場合 - * @deprecated use {@link EntityModel#getSuperEntities(boolean)} + * @deprecated use {@link EntityModel#findSuperEntities(boolean)} */ @Deprecated public static Collection<EntityModel> getReferenceEntities(EntityModel entityModel, boolean recursive) { Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/ForeignKeyUtil.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/ForeignKeyUtil.java 2009-04-28 03:01:56 UTC (rev 3335) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/ForeignKeyUtil.java 2009-04-29 23:09:43 UTC (rev 3336) @@ -96,7 +96,7 @@ * @return この外部キーが参照するエンティティ. 参照エンティティが見つからない場合は{@code null} * @throws ModelConsistenceException 参照カラムが1つもない場合 * @throws IllegalArgumentException 引数に{@code null}を与えた場合 - * @deprecated use {@link ForeignKey#getReferencedEntity()} + * @deprecated use {@link ForeignKey#findReferencedEntity()} */ @Deprecated public static EntityModel getReferenceEntity(ForeignKey foreignKey) { @@ -129,7 +129,7 @@ * @return この外部キーが参照するキー * @see ForeignKeyValidator * @throws IllegalArgumentException 引数に{@code null}を与えた場合 - * @deprecated use {@link ForeignKey#getReferencedKeyConstraint()} + * @deprecated use {@link ForeignKey#findReferencedKeyConstraint()} */ @Deprecated public static KeyConstraint getReferenceKeyConstraint(ForeignKey foreignKey) { Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/RootModelUtil.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/RootModelUtil.java 2009-04-28 03:01:56 UTC (rev 3335) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/RootModelUtil.java 2009-04-29 23:09:43 UTC (rev 3336) @@ -188,7 +188,7 @@ * @return SQL方言 * @throws ClassNotFoundException 設定されたクラスが見つからなかった場合 * @throws IllegalArgumentException 引数に{@code null}を与えた場合 - * @deprecated use {@link RootModel#getDialect()} + * @deprecated use {@link RootModel#findDialect()} */ @Deprecated public static Dialect getDialect(RootModel rootModel) throws ClassNotFoundException { Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/TableUtil.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/TableUtil.java 2009-04-28 03:01:56 UTC (rev 3335) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/TableUtil.java 2009-04-29 23:09:43 UTC (rev 3336) @@ -198,7 +198,7 @@ * @param tableModel 対象のテーブル * @return カラムのリスト * @throws IllegalArgumentException 引数に{@code null}を与えた場合 - * @deprecated use {@link TableModel#getColumns()} + * @deprecated use {@link TableModel#findColumns()} */ @Deprecated public static List<ColumnModel> getColumns(TableModel tableModel) { @@ -256,7 +256,7 @@ * @throws TooManyElementsException 複数の主キーが見つかった場合 * @throws ElementNotFoundException 主キーが存在しない場合 * @throws IllegalArgumentException 引数に{@code null}を与えた場合 - * @deprecated use {@link TableModel#getPrimaryKey()} + * @deprecated use {@link TableModel#findPrimaryKey()} */ @Deprecated public static PrimaryKey getPrimaryKey(TableModel tableModel) { Modified: artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/JiemamyPropertyTest.java =================================================================== --- artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/JiemamyPropertyTest.java 2009-04-28 03:01:56 UTC (rev 3335) +++ artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/JiemamyPropertyTest.java 2009-04-29 23:09:43 UTC (rev 3336) @@ -136,7 +136,7 @@ } String fieldName = ReflectionUtil.convertAccessorToFieldName(method); try { - clazz.getField(fieldName); + clazz.getDeclaredField(fieldName); } catch (NoSuchFieldException e) { if (Arrays.asList("adapter", "adapters").contains(fieldName) == false) { fail(clazz.getName() + " is not have " + fieldName); Modified: leto/jiemamy-commons/trunk/src/main/java/org/jiemamy/utils/ReflectionUtil.java =================================================================== --- leto/jiemamy-commons/trunk/src/main/java/org/jiemamy/utils/ReflectionUtil.java 2009-04-28 03:01:56 UTC (rev 3335) +++ leto/jiemamy-commons/trunk/src/main/java/org/jiemamy/utils/ReflectionUtil.java 2009-04-29 23:09:43 UTC (rev 3336) @@ -516,6 +516,10 @@ * @return getterであれば{@code true} */ public static boolean isGetter(Method method) { + Class<?>[] parameterTypes = method.getParameterTypes(); + if (parameterTypes.length != 0) { + return false; + } Class<?> returnType = method.getReturnType(); String name = method.getName(); if (returnType == void.class || returnType == Void.class) { @@ -541,6 +545,10 @@ if (parameterTypes.length != 1) { return false; } + Class<?> returnType = method.getReturnType(); + if (returnType != void.class && returnType != Void.class) { + return false; + } String name = method.getName(); return name.startsWith(SET) && name.length() > 3 && CharUtils.isAsciiAlphaUpper(name.toCharArray()[3]); } Modified: zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/RootModel.java =================================================================== --- zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/RootModel.java 2009-04-28 03:01:56 UTC (rev 3335) +++ zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/RootModel.java 2009-04-29 23:09:43 UTC (rev 3336) @@ -74,7 +74,7 @@ * @throws IllegalArgumentException 引数に{@code null}を与えた場合 * @throws UnsupportedOperationException 実装がこのメソッドをサポートしない場合 */ - Dialect getDialect() throws ClassNotFoundException; + Dialect findDialect() throws ClassNotFoundException; /** * SQL方言IDを取得する。 Modified: zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/attribute/AttributeModel.java =================================================================== --- zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/attribute/AttributeModel.java 2009-04-28 03:01:56 UTC (rev 3335) +++ zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/attribute/AttributeModel.java 2009-04-29 23:09:43 UTC (rev 3336) @@ -36,8 +36,9 @@ * * @return この属性が所属するテーブル. どのテーブルにも所属していない場合は{@code null} * @throws IllegalArgumentException 引数に{@code null}を与えた場合 + * @throws UnsupportedOperationException 実装がこのメソッドをサポートしない場合 */ - TableModel getDeclaringTable(); + TableModel findDeclaringTable(); /** * 説明文を取得する。 Modified: zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/attribute/ColumnModel.java =================================================================== --- zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/attribute/ColumnModel.java 2009-04-28 03:01:56 UTC (rev 3335) +++ zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/attribute/ColumnModel.java 2009-04-29 23:09:43 UTC (rev 3336) @@ -88,7 +88,7 @@ * @throws IllegalArgumentException 引数に{@code null}を与えた場合 * @throws UnsupportedOperationException 実装がこのメソッドをサポートしない場合 */ - boolean isPrimaryKeyColumn(); + boolean checkPrimaryKeyColumn(); /** * チェック制約を設定する。 Modified: zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/attribute/constraint/ForeignKey.java =================================================================== --- zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/attribute/constraint/ForeignKey.java 2009-04-28 03:01:56 UTC (rev 3335) +++ zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/attribute/constraint/ForeignKey.java 2009-04-29 23:09:43 UTC (rev 3336) @@ -33,6 +33,27 @@ public interface ForeignKey extends KeyConstraint { /** + * この外部キーが参照するエンティティを取得する。 + * + * @return この外部キーが参照するエンティティ. 参照エンティティが見つからない場合は{@code null} + * @throws ModelConsistenceException 参照カラムが1つもない場合 + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 + * @throws UnsupportedOperationException 実装がこのメソッドをサポートしない場合 + */ + EntityModel findReferencedEntity(); + + /** + * この外部キーが参照するキー制約を取得する。該当するキーが存在しなかった場合、{@code null}を返す。 + * + * <p>該当するキー制約が存在しない、という状況はモデル不整合を表す。</p> + * + * @return この外部キーが参照するキー + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 + * @throws UnsupportedOperationException 実装がこのメソッドをサポートしない場合 + */ + KeyConstraint findReferencedKeyConstraint(); + + /** * マッチ型を取得する。 * * @return マッチ型. 未設定の場合は{@code null} @@ -68,26 +89,6 @@ List<ColumnRef> getReferenceColumns(); /** - * この外部キーが参照するエンティティを取得する。 - * - * @return この外部キーが参照するエンティティ. 参照エンティティが見つからない場合は{@code null} - * @throws ModelConsistenceException 参照カラムが1つもない場合 - * @throws IllegalArgumentException 引数に{@code null}を与えた場合 - * @throws UnsupportedOperationException 実装がこのメソッドをサポートしない場合 - */ - EntityModel getReferencedEntity(); - - /** - * この外部キーが参照するキー制約を取得する。該当するキーが存在しなかった場合、{@code null}を返す。 - * - * <p>該当するキー制約が存在しない、という状況はモデル不整合を表す。</p> - * - * @return この外部キーが参照するキー - * @throws IllegalArgumentException 引数に{@code null}を与えた場合 - */ - KeyConstraint getReferencedKeyConstraint(); - - /** * 参照先カラムのリストを設定する。 * * <p>このメソッドは、インスタンスの持つフィールドをそのまま返す。返される{@link List}を直接操作することで、 Modified: zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/entity/EntityModel.java =================================================================== --- zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/entity/EntityModel.java 2009-04-28 03:01:56 UTC (rev 3335) +++ zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/entity/EntityModel.java 2009-04-29 23:09:43 UTC (rev 3336) @@ -83,7 +83,7 @@ * @throws IllegalArgumentException 引数に{@code null}を与えた場合 * @throws UnsupportedOperationException 実装がこのメソッドをサポートしない場合 */ - Collection<EntityModel> getSubEntities(boolean recursive); + Collection<EntityModel> findSubEntities(boolean recursive); /** * このエンティティ<b>が</b>依存している({@code this} → A)エンティティの集合を取得する。 @@ -98,7 +98,7 @@ * @throws IllegalArgumentException 引数に{@code null}を与えた場合 * @throws UnsupportedOperationException 実装がこのメソッドをサポートしない場合 */ - Collection<EntityModel> getSuperEntities(boolean recursive); + Collection<EntityModel> findSuperEntities(boolean recursive); /** * 開始スクリプトを設定する。 Modified: zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/entity/TableModel.java =================================================================== --- zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/entity/TableModel.java 2009-04-28 03:01:56 UTC (rev 3335) +++ zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/entity/TableModel.java 2009-04-29 23:09:43 UTC (rev 3336) @@ -107,7 +107,7 @@ * @throws IllegalArgumentException 引数に{@code null}を与えた場合 * @throws UnsupportedOperationException 実装がこのメソッドをサポートしない場合 */ - List<ColumnModel> getColumns(); + List<ColumnModel> findColumns(); /** * 外部キー制約のリストを取得する。 @@ -118,7 +118,7 @@ * @throws IllegalArgumentException 引数に{@code null}を与えた場合 * @throws UnsupportedOperationException 実装がこのメソッドをサポートしない場合 */ - List<ForeignKey> getForeignKeys(); + List<ForeignKey> findForeignKeys(); /** * インデックスのリストを取得する。 @@ -142,5 +142,5 @@ * @throws IllegalArgumentException 引数に{@code null}を与えた場合 * @throws UnsupportedOperationException 実装がこのメソッドをサポートしない場合 */ - PrimaryKey getPrimaryKey(); + PrimaryKey findPrimaryKey(); }