Overrides, from David Hoover (belatedly): 'Also nukes trailing whitespace, foreaches a couple loops and varags one thing that leapt out at me while i was skimming it.'

This commit is contained in:
Par Winzell
2009-04-29 16:17:39 +00:00
parent 95212f57e2
commit 27b108b0c4
64 changed files with 100 additions and 90 deletions
+1
View File
@@ -174,6 +174,7 @@ public class Key<T extends PersistentRecord> extends WhereClause
}
// from WhereClause
@Override
public SQLExpression getWhereExpression ()
{
return new Expression<T>(_pClass, _values);
+9 -11
View File
@@ -30,6 +30,7 @@ import java.util.Iterator;
import com.google.common.collect.Iterators;
import com.google.common.base.Function;
import com.samskivert.util.Logger;
import com.samskivert.util.StringUtil;
import com.samskivert.depot.clause.WhereClause;
@@ -127,8 +128,7 @@ public abstract class KeySet<T extends PersistentRecord> extends WhereClause
super(pClass);
}
// from WhereClause
public SQLExpression getWhereExpression () {
@Override public SQLExpression getWhereExpression () {
return new LiteralExp("(1 = 0)");
}
@@ -169,8 +169,7 @@ public abstract class KeySet<T extends PersistentRecord> extends WhereClause
_keys = keys;
}
// from WhereClause
public SQLExpression getWhereExpression () {
@Override public SQLExpression getWhereExpression () {
// Single-column keys result in the compact IN(keyVal1, keyVal2, ...)
ColumnExp column = new ColumnExp(_pClass, DepotUtil.getKeyFields(_pClass)[0]);
return new Conditionals.In(column, _keys);
@@ -220,8 +219,7 @@ public abstract class KeySet<T extends PersistentRecord> extends WhereClause
_keys = keys;
}
// from WhereClause
public SQLExpression getWhereExpression () {
@Override public SQLExpression getWhereExpression () {
// Multi-column keys result in OR'd AND's, of unknown efficiency (TODO check).
SQLExpression[] keyexps = new SQLExpression[_keys.length];
int ii = 0;
@@ -273,10 +271,10 @@ public abstract class KeySet<T extends PersistentRecord> extends WhereClause
public Collection<Key<T>> toCollection ()
{
return new AbstractCollection<Key<T>>() {
public Iterator<Key<T>> iterator () {
@Override public Iterator<Key<T>> iterator () {
return KeySet.this.iterator();
}
public int size () {
@Override public int size () {
return KeySet.this.size();
}
};
@@ -310,9 +308,9 @@ public abstract class KeySet<T extends PersistentRecord> extends WhereClause
public void validateFlushType (Class<?> pClass)
{
if (!pClass.equals(_pClass)) {
throw new IllegalArgumentException(
"Class mismatch between persistent record and cache invalidator " +
"[record=" + pClass.getSimpleName() + ", invtype=" + _pClass.getSimpleName() + "].");
throw new IllegalArgumentException(Logger.format(
"Class mismatch between persistent record and cache invalidator",
"record", pClass.getSimpleName(), "invtype", _pClass.getSimpleName()));
}
}
@@ -66,7 +66,7 @@ public class Where extends WhereClause
_condition = condition;
}
// from WhereClause
@Override // from WhereClause
public SQLExpression getWhereExpression ()
{
return _condition;
@@ -50,8 +50,8 @@ public class FunctionExp implements SQLExpression
// from SQLExpression
public void addClasses (Collection<Class<? extends PersistentRecord>> classSet)
{
for (int ii = 0; ii < _arguments.length; ii ++) {
_arguments[ii].addClasses(classSet);
for (SQLExpression _argument : _arguments) {
_argument.addClasses(classSet);
}
}
@@ -65,6 +65,7 @@ public class FunctionExp implements SQLExpression
return _arguments;
}
@Override
public String toString ()
{
return _function + "(" + StringUtil.join(_arguments, ", ") + ")";
@@ -53,6 +53,7 @@ public class LiteralExp
return _text;
}
@Override
public String toString ()
{
return _text;
@@ -38,7 +38,7 @@ public interface SQLExpression
_reason = reason;
}
public String toString () {
@Override public String toString () {
return "[unknown value, reason=" + _reason + "]";
}
@@ -504,12 +504,12 @@ public class DepotMarshaller<T extends PersistentRecord>
_columnFields = new String[_allFields.length];
ColumnDefinition[] declarations = new ColumnDefinition[_allFields.length];
int jj = 0;
for (int ii = 0; ii < _allFields.length; ii++) {
FieldMarshaller<?> fm = _fields.get(_allFields[ii]);
for (String field : _allFields) {
FieldMarshaller<?> fm = _fields.get(field);
// include all persistent non-computed fields
ColumnDefinition colDef = fm.getColumnDefinition();
if (colDef != null) {
_columnFields[jj] = _allFields[ii];
_columnFields[jj] = field;
declarations[jj] = colDef;
jj ++;
}
@@ -547,6 +547,7 @@ public class DepotMarshaller<T extends PersistentRecord>
log.info("Creating initial version record for " + _pClass.getName() + ".");
// if not, create a version entry with version zero
ctx.invoke(new SimpleModifier() {
@Override
protected int invoke (DatabaseLiaison liaison, Statement stmt) throws SQLException {
try {
return stmt.executeUpdate(
@@ -605,6 +606,7 @@ public class DepotMarshaller<T extends PersistentRecord>
// and update our version in the schema version table
ctx.invoke(new SimpleModifier() {
@Override
protected int invoke (DatabaseLiaison liaison, Statement stmt) throws SQLException {
return stmt.executeUpdate(
"update " + liaison.tableSQL(SCHEMA_VERSION_TABLE) +
@@ -1035,6 +1037,7 @@ public class DepotMarshaller<T extends PersistentRecord>
// server to whom we would talk if we were doing a modification (ie. the master, not a
// read-only slave)
protected class ReadVersion extends SimpleModifier {
@Override
protected int invoke (DatabaseLiaison liaison, Statement stmt) throws SQLException {
ResultSet rs = stmt.executeQuery(
" select " + liaison.columnSQL(V_COLUMN) +
@@ -1049,6 +1052,7 @@ public class DepotMarshaller<T extends PersistentRecord>
_newMigratingVersion = newMigratingVersion;
_guardVersion = guardVersion;
}
@Override
protected int invoke (DatabaseLiaison liaison, Statement stmt) throws SQLException {
return stmt.executeUpdate(
"update " + liaison.tableSQL(SCHEMA_VERSION_TABLE) +
@@ -1121,6 +1125,7 @@ public class DepotMarshaller<T extends PersistentRecord>
}
}
@Override
public String toString ()
{
return StringUtil.fieldsToString(this);
@@ -102,6 +102,7 @@ public class HSQLBuilder
return null;
}
@Override
public Void visit (MultiOperator operator)
{
String op;
@@ -129,6 +130,7 @@ public class HSQLBuilder
return null;
}
@Override
public Void visit (EpochSeconds epochSeconds)
{
_builder.append("datediff('ss', ");
@@ -92,6 +92,7 @@ public class MySQLBuilder
return null;
}
@Override
public Void visit (EpochSeconds epochSeconds)
{
_builder.append("unix_timestamp(");
@@ -51,7 +51,8 @@ public class TestRepository extends DepotRepository
{
public int recordId;
public String name;
public String toString () {
@Override public String toString () {
return recordId + ":" + name;
}
}