提交 631e7a00 authored 作者: Thomas Mueller's avatar Thomas Mueller

Cleanup:

- Improve Javadoc documentation
- Javadoc: removed unpaired <p>
- Javadoc: removed shouting (bold, caps "MUST")
- Javadoc: document parameters
- Javadoc: no need to write Return in a @return tag
- Javadoc: make correct sentences, not sentence fragments ('Default Db Upgrader.' is not a sentence)
- Remove @Override tag because this won't compile with JDK 5
- Methods in public interfaces don't need to be declared public (Checkstyle detects this, please use Checkstyle as documented)
上级 b51dab94
......@@ -9,12 +9,9 @@ import org.h2.jaqu.Table.JQDatabase;
/**
* Interface which defines a class to handle table changes based on model
* versions.
* <p>
* An implementation of <i>DbUpgrader</i> <b>MUST</b> be annotated with the
* <i>JQDatabase</i> annotation. This annotation defines the expected database
* version number.
*
* versions. An implementation of <i>DbUpgrader</i> must be annotated with the
* <i>JQDatabase</i> annotation, which defines the expected database version
* number.
*/
public interface DbUpgrader {
......@@ -23,46 +20,42 @@ public interface DbUpgrader {
* called if your <i>DbUpgrader</i> implementation is annotated with
* JQDatabase.
*
* @param db
* @param fromVersion
* @param toVersion
* @return Returns <b>true</b> for successful upgrade.<br>
* If update is successful, JaQu automatically updates its version
* registry.
* @param db the database
* @param fromVersion the old version
* @param toVersion the new version
* @return true for successful upgrade. If the upgrade is successful, the
* version registry is automatically updated.
*/
public boolean upgradeDatabase(Db db, int fromVersion, int toVersion);
boolean upgradeDatabase(Db db, int fromVersion, int toVersion);
/**
* Defines method interface to handle table upgrades.
*
* @param db
* @param schema
* @param table
* @param fromVersion
* @param toVersion
* @return Returns <b>true</b> for successful upgrade.<br>
* If update is successful, JaQu automatically updates its version
* registry.
* @param db the database
* @param schema the schema
* @param table the table
* @param fromVersion the old version
* @param toVersion the new version
* @return true for successful upgrade. If the upgrade is successful, the
* version registry is automatically updated.
*/
public boolean upgradeTable(Db db, String schema, String table, int fromVersion, int toVersion);
boolean upgradeTable(Db db, String schema, String table, int fromVersion, int toVersion);
/**
* Default Db Upgrader.
* <p>
* Does <b>NOT</b> handle upgrade requests. Instead, this throws
* RuntimeExceptions.
* The default database upgrader. It throws runtime exception instead of
* handling upgrade requests.
*/
@JQDatabase(version = 0)
public static class DefaultDbUpgrader implements DbUpgrader {
@Override
public boolean upgradeDatabase(Db db, int fromVersion, int toVersion) {
throw new RuntimeException("Please provide your own DbUpgrader implementation.");
}
@Override
public boolean upgradeTable(Db db, String schema, String table, int fromVersion, int toVersion) {
throw new RuntimeException("Please provide your own DbUpgrader implementation.");
}
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论