net.java.ao.schema.TableNameConverterのJavadoc

ActiveObjectのnet.java.ao.schema.TableNameConverterインタフェースのJavadocの日本語訳です。原文は、https://activeobjects.dev.java.net/api/net/java/ao/schema/TableNameConverter.htmlです。

以下、日本語訳

net.java.ao.schema 
Interface TableNameConverter
既知の実装クラスの一覧:
	AbstractTableNameConverter, CamelCaseTableNameConverter, PluralizedNameConverter, UnderscoreTableNameConverter


public interface TableNameConverter

すべてのテーブル名コンバータのスーパインタフェースです。このインタフェースの目的は、クラス名からデータベースのテーブル名への自動変換の規約を適用することです。背景には、ActiveObjectsの考える「良い命名」を常に強制するのではなく、ユーザがテーブル名の規約と標準を決められるようにする意図があります。

Superinterface to all table name converters; designed to impose conventions upon the auto-conversion of class names to database tables. The idea behind this is to allow user-specified table name conventions and standards rather than always enforcing ActiveObjects's idea of "good naming".

EntityManagerは必ずテーブル名コンバータを一つだけ持ちます。テーブル名コンバータはライブラリの様々な処理で使用されます。テーブルと直接やり取りするサードパーティのコードでは、この機能を活用した方がよいです。ORM外の操作であってもテーブル名コンバータを使えば、開発者はテーブル名のコントロールを一か所でできるため、規約のメンテナンスが一か所だけで済みます。

Every EntityManager contains a single table name converter which the entire library uses when performing operations. Any third-party code which interacts with tables directly should make use of this faculty. By using the table name converter even in ORM-external operations, the developers can control table names in a single location and ensure that the conventions need only be maintained in one spot.

新たなテーブル名コンバータを作る場合、通常は、このインタフェースを直接実装するより、AbstractTableNameConverterを継承した方がよいです。AbstractTableNameConverterを継承すると、サードパーティのコンバータで共通の変換コードを使用できるため効果的です。さもなくば、すべてのコンバータに共通のコードを繰り返さなければなりません。

Most new implementations of table name converters should extend AbstractTableNameConverter rather than implementing this interface directly. This allows third-party converters to take advantage of boiler-plate conversion code which would otherwise have to be duplicated in every converter.

作成者:
	Daniel Spiewak


メソッドの概要 - Method Summary

String getName(Class<? extends RawEntity<?>> clazz) 指定されたクラスに対応するテーブル名を生成します。

メソッドの詳細 - Method Detail

getName
String getName(Class> clazz)

指定されたクラスに対応するテーブル名を生成します。生成に使用するアルゴリズムでは、テーブルアノテーションがの存在を確認し、存在する場合には処理を変える必要があります。もしこの確認をしなければ、ActiveObjectsは普通に処理を続行するので、@Tableの実装では失敗することがあるでしょう。

Generates a table name to correspond with the specified class. The algorithm used must check for the existance of the Table annotation and use the appropriate override when necessary. If this check is not made, ActiveObjects will continue to function normally, but any code assuming the proper imlementation of @Table will likely fail.

引数 - Parameters:
	clazz - テーブル名を生成したいエンティティ型
戻り値 - Returns:
	指定したエンティティ型に対応するデータベースのテーブル名