提交 e38a0a80 authored 作者: Thomas Mueller's avatar Thomas Mueller

Cleanup:

- Improve Javadoc documentation
- Javadoc: add missing documentation for <T> (the IDE or checkstyle flags this) 
- Javadoc: removed trailing whitespace
- Remove @Override tag because this won't compile with JDK 5
- Flag that there is something wrong (what if 'y' isn't a Number? anyway instanceof should be avoided)
上级 631e7a00
...@@ -7,8 +7,9 @@ ...@@ -7,8 +7,9 @@
package org.h2.jaqu; package org.h2.jaqu;
/** /**
* This class represents a "column=(column + 1)" token for a SET statement. * This class represents "SET column = (column + 1)" in an UPDATE statement.
* *
* @param <T> the query type
* @param <A> the new value data type * @param <A> the new value data type
*/ */
//## Java 1.5 begin ## //## Java 1.5 begin ##
...@@ -22,25 +23,27 @@ public class IncrementColumn<T, A> implements Declaration { ...@@ -22,25 +23,27 @@ public class IncrementColumn<T, A> implements Declaration {
this.query = query; this.query = query;
this.x = x; this.x = x;
} }
public Query<T> by(A y) { public Query<T> by(A y) {
query.addDeclarationToken(this); query.addDeclarationToken(this);
this.y = y; this.y = y;
return query; return query;
} }
@Override
public void appendSQL(SQLStatement stat) { public void appendSQL(SQLStatement stat) {
query.appendSQL(stat, x); query.appendSQL(stat, x);
stat.appendSQL("=("); stat.appendSQL("=(");
query.appendSQL(stat, x); query.appendSQL(stat, x);
int todoSomethingWrongHere;
if (y instanceof Number) { if (y instanceof Number) {
Number n = (Number) y; Number n = (Number) y;
if (n.doubleValue() > 0) if (n.doubleValue() > 0) {
stat.appendSQL("+"); stat.appendSQL("+");
}
} }
stat.appendSQL(y.toString()); stat.appendSQL(y.toString());
stat.appendSQL(")"); stat.appendSQL(")");
} }
} }
//## Java 1.5 end ## //## Java 1.5 end ##
...@@ -57,7 +57,6 @@ public interface SQLDialect { ...@@ -57,7 +57,6 @@ public interface SQLDialect {
*/ */
public static class DefaultSQLDialect implements SQLDialect { public static class DefaultSQLDialect implements SQLDialect {
@Override
public String tableName(String schema, String table) { public String tableName(String schema, String table) {
if (StringUtils.isNullOrEmpty(schema)) { if (StringUtils.isNullOrEmpty(schema)) {
return table; return table;
...@@ -65,7 +64,6 @@ public interface SQLDialect { ...@@ -65,7 +64,6 @@ public interface SQLDialect {
return schema + "." + table; return schema + "." + table;
} }
@Override
public String createIndex(String schema, String table, IndexDefinition index) { public String createIndex(String schema, String table, IndexDefinition index) {
StatementBuilder buff = new StatementBuilder(); StatementBuilder buff = new StatementBuilder();
buff.append("CREATE "); buff.append("CREATE ");
...@@ -95,12 +93,10 @@ public interface SQLDialect { ...@@ -95,12 +93,10 @@ public interface SQLDialect {
return buff.toString(); return buff.toString();
} }
@Override
public void appendLimit(SQLStatement stat, long limit) { public void appendLimit(SQLStatement stat, long limit) {
stat.appendSQL(" LIMIT " + limit); stat.appendSQL(" LIMIT " + limit);
} }
@Override
public void appendOffset(SQLStatement stat, long offset) { public void appendOffset(SQLStatement stat, long offset) {
stat.appendSQL(" OFFSET " + offset); stat.appendSQL(" OFFSET " + offset);
} }
......
...@@ -7,8 +7,9 @@ ...@@ -7,8 +7,9 @@
package org.h2.jaqu; package org.h2.jaqu;
/** /**
* This class represents a "column=value" token for a SET statement. * This class represents "SET column = value" in an UPDATE statement.
* *
* @param <T> the query type
* @param <A> the new value data type * @param <A> the new value data type
*/ */
//## Java 1.5 begin ## //## Java 1.5 begin ##
...@@ -22,18 +23,18 @@ public class SetColumn<T, A> implements Declaration { ...@@ -22,18 +23,18 @@ public class SetColumn<T, A> implements Declaration {
this.query = query; this.query = query;
this.x = x; this.x = x;
} }
public Query<T> to(A y) { public Query<T> to(A y) {
query.addDeclarationToken(this); query.addDeclarationToken(this);
this.y = y; this.y = y;
return query; return query;
} }
@Override
public void appendSQL(SQLStatement stat) { public void appendSQL(SQLStatement stat) {
query.appendSQL(stat, x); query.appendSQL(stat, x);
stat.appendSQL("=?"); stat.appendSQL("=?");
stat.addParameter(y); stat.addParameter(y);
} }
} }
//## Java 1.5 end ## //## Java 1.5 end ##
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论