From 27b108b0c476eb1a1fe99a5feee790082c9032b9 Mon Sep 17 00:00:00 2001 From: Par Winzell Date: Wed, 29 Apr 2009 16:17:39 +0000 Subject: [PATCH] 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.' --- src/java/com/samskivert/depot/ByteEnum.java | 2 +- .../samskivert/depot/CacheInvalidator.java | 2 +- src/java/com/samskivert/depot/CacheKey.java | 2 +- .../com/samskivert/depot/DataMigration.java | 2 +- .../samskivert/depot/DatabaseException.java | 2 +- .../com/samskivert/depot/DepotRepository.java | 6 ++--- .../depot/DuplicateKeyException.java | 2 +- src/java/com/samskivert/depot/Key.java | 3 ++- src/java/com/samskivert/depot/KeySet.java | 22 +++++++++---------- src/java/com/samskivert/depot/Log.java | 2 +- .../samskivert/depot/PersistentRecord.java | 2 +- .../com/samskivert/depot/SchemaMigration.java | 6 ++--- .../com/samskivert/depot/SimpleCacheKey.java | 2 +- src/java/com/samskivert/depot/Stats.java | 2 +- .../depot/ValidatingCacheInvalidator.java | 2 +- .../samskivert/depot/annotation/Column.java | 2 +- .../samskivert/depot/annotation/Computed.java | 2 +- .../samskivert/depot/annotation/Entity.java | 2 +- .../depot/annotation/FullTextIndex.java | 6 ++--- .../depot/annotation/GeneratedValue.java | 2 +- .../depot/annotation/GenerationType.java | 2 +- .../com/samskivert/depot/annotation/Id.java | 2 +- .../depot/annotation/TableGenerator.java | 2 +- .../depot/annotation/Transient.java | 2 +- .../depot/annotation/UniqueConstraint.java | 2 +- .../depot/clause/FieldDefinition.java | 2 +- .../depot/clause/FieldOverride.java | 2 +- .../samskivert/depot/clause/ForUpdate.java | 2 +- .../samskivert/depot/clause/FromOverride.java | 2 +- .../com/samskivert/depot/clause/GroupBy.java | 2 +- .../samskivert/depot/clause/InsertClause.java | 2 +- .../com/samskivert/depot/clause/Join.java | 2 +- .../com/samskivert/depot/clause/Limit.java | 2 +- .../com/samskivert/depot/clause/OrderBy.java | 2 +- .../samskivert/depot/clause/QueryClause.java | 2 +- .../samskivert/depot/clause/SelectClause.java | 2 +- .../com/samskivert/depot/clause/Where.java | 4 ++-- .../samskivert/depot/clause/WhereClause.java | 2 +- .../depot/expression/ColumnExp.java | 2 +- .../depot/expression/EpochSeconds.java | 2 +- .../depot/expression/FunctionExp.java | 7 +++--- .../depot/expression/LiteralExp.java | 3 ++- .../depot/expression/SQLExpression.java | 4 ++-- .../samskivert/depot/expression/ValueExp.java | 2 +- .../depot/impl/DepotMarshaller.java | 17 +++++++++----- .../impl/DepotMigrationHistoryRecord.java | 2 +- .../com/samskivert/depot/impl/DepotUtil.java | 2 +- .../depot/impl/FieldMarshaller.java | 4 ++-- .../depot/impl/FindAllKeysQuery.java | 2 +- .../samskivert/depot/impl/FindAllQuery.java | 4 ++-- .../samskivert/depot/impl/FindOneQuery.java | 2 +- .../samskivert/depot/impl/HSQLBuilder.java | 2 ++ .../depot/impl/IdentityValueGenerator.java | 2 +- .../samskivert/depot/impl/MySQLBuilder.java | 1 + .../com/samskivert/depot/impl/Operation.java | 2 +- src/java/com/samskivert/depot/impl/Query.java | 2 +- .../depot/impl/TableValueGenerator.java | 2 +- .../samskivert/depot/impl/ValueGenerator.java | 2 +- .../depot/impl/clause/DeleteClause.java | 2 +- .../depot/impl/clause/UpdateClause.java | 2 +- .../samskivert/depot/operator/Arithmetic.java | 2 +- .../com/samskivert/depot/operator/Logic.java | 2 +- .../depot/operator/SQLOperator.java | 2 +- .../depot/tests/TestRepository.java | 3 ++- 64 files changed, 100 insertions(+), 90 deletions(-) diff --git a/src/java/com/samskivert/depot/ByteEnum.java b/src/java/com/samskivert/depot/ByteEnum.java index 32fd88d..4d4f4d0 100644 --- a/src/java/com/samskivert/depot/ByteEnum.java +++ b/src/java/com/samskivert/depot/ByteEnum.java @@ -3,7 +3,7 @@ // // Depot library - a Java relational persistence library // Copyright (C) 2006-2008 Michael Bayne and Pär Winzell -// +// // This library is free software; you can redistribute it and/or modify it // under the terms of the GNU Lesser General Public License as published // by the Free Software Foundation; either version 2.1 of the License, or diff --git a/src/java/com/samskivert/depot/CacheInvalidator.java b/src/java/com/samskivert/depot/CacheInvalidator.java index 5bb4c12..a2d38c1 100644 --- a/src/java/com/samskivert/depot/CacheInvalidator.java +++ b/src/java/com/samskivert/depot/CacheInvalidator.java @@ -3,7 +3,7 @@ // // Depot library - a Java relational persistence library // Copyright (C) 2006-2008 Michael Bayne and Pär Winzell -// +// // This library is free software; you can redistribute it and/or modify it // under the terms of the GNU Lesser General Public License as published // by the Free Software Foundation; either version 2.1 of the License, or diff --git a/src/java/com/samskivert/depot/CacheKey.java b/src/java/com/samskivert/depot/CacheKey.java index 2ad7fbf..4c5d735 100644 --- a/src/java/com/samskivert/depot/CacheKey.java +++ b/src/java/com/samskivert/depot/CacheKey.java @@ -3,7 +3,7 @@ // // Depot library - a Java relational persistence library // Copyright (C) 2006-2008 Michael Bayne and Pär Winzell -// +// // This library is free software; you can redistribute it and/or modify it // under the terms of the GNU Lesser General Public License as published // by the Free Software Foundation; either version 2.1 of the License, or diff --git a/src/java/com/samskivert/depot/DataMigration.java b/src/java/com/samskivert/depot/DataMigration.java index 14d9065..ec78110 100644 --- a/src/java/com/samskivert/depot/DataMigration.java +++ b/src/java/com/samskivert/depot/DataMigration.java @@ -3,7 +3,7 @@ // // Depot library - a Java relational persistence library // Copyright (C) 2006-2008 Michael Bayne and Pär Winzell -// +// // This library is free software; you can redistribute it and/or modify it // under the terms of the GNU Lesser General Public License as published // by the Free Software Foundation; either version 2.1 of the License, or diff --git a/src/java/com/samskivert/depot/DatabaseException.java b/src/java/com/samskivert/depot/DatabaseException.java index a376c5b..0645076 100644 --- a/src/java/com/samskivert/depot/DatabaseException.java +++ b/src/java/com/samskivert/depot/DatabaseException.java @@ -3,7 +3,7 @@ // // Depot library - a Java relational persistence library // Copyright (C) 2006-2008 Michael Bayne and Pär Winzell -// +// // This library is free software; you can redistribute it and/or modify it // under the terms of the GNU Lesser General Public License as published // by the Free Software Foundation; either version 2.1 of the License, or diff --git a/src/java/com/samskivert/depot/DepotRepository.java b/src/java/com/samskivert/depot/DepotRepository.java index 57d6b10..266f22b 100644 --- a/src/java/com/samskivert/depot/DepotRepository.java +++ b/src/java/com/samskivert/depot/DepotRepository.java @@ -105,7 +105,7 @@ public abstract class DepotRepository * in the first pass. This makes it much more efficient, but also less reliable because * there is no invalidation of the keyset query: If records are inserted, deleted or * modified, cached keysets will not be updated. - * + * * Keysets cached using this strategy may have a long time-to-live. * * Note: This strategy may not be used on @Computed records, for records that do not in @@ -411,7 +411,7 @@ public abstract class DepotRepository switch(cache) { case SHORT_KEYS: case LONG_KEYS: case RECORDS: return _ctx.invoke(new FindAllQuery.WithCache(_ctx, type, clauses, cache)); - + default: return _ctx.invoke(new FindAllQuery.Explicitly( _ctx, type, clauses, cache == CacheStrategy.CONTENTS)); @@ -693,7 +693,7 @@ public abstract class DepotRepository "Field identifier #" + (ii+1) + " is neither String nor ColumnExp"); } idx ++; - + if (fieldsValues[idx] instanceof SQLExpression) { values[ii] = (SQLExpression) fieldsValues[idx]; } else { diff --git a/src/java/com/samskivert/depot/DuplicateKeyException.java b/src/java/com/samskivert/depot/DuplicateKeyException.java index 0bf4cab..5b246ab 100644 --- a/src/java/com/samskivert/depot/DuplicateKeyException.java +++ b/src/java/com/samskivert/depot/DuplicateKeyException.java @@ -3,7 +3,7 @@ // // Depot library - a Java relational persistence library // Copyright (C) 2006-2008 Michael Bayne and Pär Winzell -// +// // This library is free software; you can redistribute it and/or modify it // under the terms of the GNU Lesser General Public License as published // by the Free Software Foundation; either version 2.1 of the License, or diff --git a/src/java/com/samskivert/depot/Key.java b/src/java/com/samskivert/depot/Key.java index b7f577f..d01471a 100644 --- a/src/java/com/samskivert/depot/Key.java +++ b/src/java/com/samskivert/depot/Key.java @@ -3,7 +3,7 @@ // // Depot library - a Java relational persistence library // Copyright (C) 2006-2008 Michael Bayne and Pär Winzell -// +// // This library is free software; you can redistribute it and/or modify it // under the terms of the GNU Lesser General Public License as published // by the Free Software Foundation; either version 2.1 of the License, or @@ -174,6 +174,7 @@ public class Key extends WhereClause } // from WhereClause + @Override public SQLExpression getWhereExpression () { return new Expression(_pClass, _values); diff --git a/src/java/com/samskivert/depot/KeySet.java b/src/java/com/samskivert/depot/KeySet.java index 692864c..18a55d8 100644 --- a/src/java/com/samskivert/depot/KeySet.java +++ b/src/java/com/samskivert/depot/KeySet.java @@ -3,7 +3,7 @@ // // Depot library - a Java relational persistence library // Copyright (C) 2006-2008 Michael Bayne and Pär Winzell -// +// // This library is free software; you can redistribute it and/or modify it // under the terms of the GNU Lesser General Public License as published // by the Free Software Foundation; either version 2.1 of the License, or @@ -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 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 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 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 extends WhereClause public Collection> toCollection () { return new AbstractCollection>() { - public Iterator> iterator () { + @Override public Iterator> iterator () { return KeySet.this.iterator(); } - public int size () { + @Override public int size () { return KeySet.this.size(); } }; @@ -310,9 +308,9 @@ public abstract class KeySet 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())); } } diff --git a/src/java/com/samskivert/depot/Log.java b/src/java/com/samskivert/depot/Log.java index 5b5e0d6..da1f9de 100644 --- a/src/java/com/samskivert/depot/Log.java +++ b/src/java/com/samskivert/depot/Log.java @@ -3,7 +3,7 @@ // // Depot library - a Java relational persistence library // Copyright (C) 2006-2008 Michael Bayne and Pär Winzell -// +// // This library is free software; you can redistribute it and/or modify it // under the terms of the GNU Lesser General Public License as published // by the Free Software Foundation; either version 2.1 of the License, or diff --git a/src/java/com/samskivert/depot/PersistentRecord.java b/src/java/com/samskivert/depot/PersistentRecord.java index 7f87378..e9741b5 100644 --- a/src/java/com/samskivert/depot/PersistentRecord.java +++ b/src/java/com/samskivert/depot/PersistentRecord.java @@ -3,7 +3,7 @@ // // Depot library - a Java relational persistence library // Copyright (C) 2006-2008 Michael Bayne and Pär Winzell -// +// // This library is free software; you can redistribute it and/or modify it // under the terms of the GNU Lesser General Public License as published // by the Free Software Foundation; either version 2.1 of the License, or diff --git a/src/java/com/samskivert/depot/SchemaMigration.java b/src/java/com/samskivert/depot/SchemaMigration.java index 39df2e4..92938eb 100644 --- a/src/java/com/samskivert/depot/SchemaMigration.java +++ b/src/java/com/samskivert/depot/SchemaMigration.java @@ -3,7 +3,7 @@ // // Depot library - a Java relational persistence library // Copyright (C) 2006-2008 Michael Bayne and Pär Winzell -// +// // This library is free software; you can redistribute it and/or modify it // under the terms of the GNU Lesser General Public License as published // by the Free Software Foundation; either version 2.1 of the License, or @@ -218,7 +218,7 @@ public abstract class SchemaMigration extends Modifier super(targetVersion); _ixName = ixName; } - + @Override protected int invoke (Connection conn, DatabaseLiaison liaison) throws SQLException { String fullIxName = _tableName + "_" + _ixName; @@ -231,7 +231,7 @@ public abstract class SchemaMigration extends Modifier liaison.dropIndex(conn, _tableName, fullIxName); return 1; } - + protected String _ixName; } diff --git a/src/java/com/samskivert/depot/SimpleCacheKey.java b/src/java/com/samskivert/depot/SimpleCacheKey.java index 3ac034b..2cf519e 100644 --- a/src/java/com/samskivert/depot/SimpleCacheKey.java +++ b/src/java/com/samskivert/depot/SimpleCacheKey.java @@ -3,7 +3,7 @@ // // Depot library - a Java relational persistence library // Copyright (C) 2006-2008 Michael Bayne and Pär Winzell -// +// // This library is free software; you can redistribute it and/or modify it // under the terms of the GNU Lesser General Public License as published // by the Free Software Foundation; either version 2.1 of the License, or diff --git a/src/java/com/samskivert/depot/Stats.java b/src/java/com/samskivert/depot/Stats.java index 1bbbb30..69d35c3 100644 --- a/src/java/com/samskivert/depot/Stats.java +++ b/src/java/com/samskivert/depot/Stats.java @@ -3,7 +3,7 @@ // // Depot library - a Java relational persistence library // Copyright (C) 2006-2008 Michael Bayne and Pär Winzell -// +// // This library is free software; you can redistribute it and/or modify it // under the terms of the GNU Lesser General Public License as published // by the Free Software Foundation; either version 2.1 of the License, or diff --git a/src/java/com/samskivert/depot/ValidatingCacheInvalidator.java b/src/java/com/samskivert/depot/ValidatingCacheInvalidator.java index 354486e..d09adec 100644 --- a/src/java/com/samskivert/depot/ValidatingCacheInvalidator.java +++ b/src/java/com/samskivert/depot/ValidatingCacheInvalidator.java @@ -3,7 +3,7 @@ // // Depot library - a Java relational persistence library // Copyright (C) 2006-2008 Michael Bayne and Pär Winzell -// +// // This library is free software; you can redistribute it and/or modify it // under the terms of the GNU Lesser General Public License as published // by the Free Software Foundation; either version 2.1 of the License, or diff --git a/src/java/com/samskivert/depot/annotation/Column.java b/src/java/com/samskivert/depot/annotation/Column.java index 44aaf87..524edeb 100644 --- a/src/java/com/samskivert/depot/annotation/Column.java +++ b/src/java/com/samskivert/depot/annotation/Column.java @@ -3,7 +3,7 @@ // // Depot library - a Java relational persistence library // Copyright (C) 2006-2008 Michael Bayne and Pär Winzell -// +// // This library is free software; you can redistribute it and/or modify it // under the terms of the GNU Lesser General Public License as published // by the Free Software Foundation; either version 2.1 of the License, or diff --git a/src/java/com/samskivert/depot/annotation/Computed.java b/src/java/com/samskivert/depot/annotation/Computed.java index 6030f2e..ac281c4 100644 --- a/src/java/com/samskivert/depot/annotation/Computed.java +++ b/src/java/com/samskivert/depot/annotation/Computed.java @@ -3,7 +3,7 @@ // // Depot library - a Java relational persistence library // Copyright (C) 2006-2008 Michael Bayne and Pär Winzell -// +// // This library is free software; you can redistribute it and/or modify it // under the terms of the GNU Lesser General Public License as published // by the Free Software Foundation; either version 2.1 of the License, or diff --git a/src/java/com/samskivert/depot/annotation/Entity.java b/src/java/com/samskivert/depot/annotation/Entity.java index f6d61b7..3ed16e3 100644 --- a/src/java/com/samskivert/depot/annotation/Entity.java +++ b/src/java/com/samskivert/depot/annotation/Entity.java @@ -3,7 +3,7 @@ // // Depot library - a Java relational persistence library // Copyright (C) 2006-2008 Michael Bayne and Pär Winzell -// +// // This library is free software; you can redistribute it and/or modify it // under the terms of the GNU Lesser General Public License as published // by the Free Software Foundation; either version 2.1 of the License, or diff --git a/src/java/com/samskivert/depot/annotation/FullTextIndex.java b/src/java/com/samskivert/depot/annotation/FullTextIndex.java index 8b2e95d..9939aa3 100644 --- a/src/java/com/samskivert/depot/annotation/FullTextIndex.java +++ b/src/java/com/samskivert/depot/annotation/FullTextIndex.java @@ -3,7 +3,7 @@ // // Depot library - a Java relational persistence library // Copyright (C) 2006-2008 Michael Bayne and Pär Winzell -// +// // This library is free software; you can redistribute it and/or modify it // under the terms of the GNU Lesser General Public License as published // by the Free Software Foundation; either version 2.1 of the License, or @@ -38,7 +38,7 @@ public @interface FullTextIndex /** For English text search; does basic stemming. */ English } - + /** * An identifier for this index, unique with the scope of the record. */ @@ -48,7 +48,7 @@ public @interface FullTextIndex * An array of the field names that should be indexed. */ public String[] fields (); - + /** * What parser/dictionary to use for this index. */ diff --git a/src/java/com/samskivert/depot/annotation/GeneratedValue.java b/src/java/com/samskivert/depot/annotation/GeneratedValue.java index 2371452..b38df13 100644 --- a/src/java/com/samskivert/depot/annotation/GeneratedValue.java +++ b/src/java/com/samskivert/depot/annotation/GeneratedValue.java @@ -3,7 +3,7 @@ // // Depot library - a Java relational persistence library // Copyright (C) 2006-2008 Michael Bayne and Pär Winzell -// +// // This library is free software; you can redistribute it and/or modify it // under the terms of the GNU Lesser General Public License as published // by the Free Software Foundation; either version 2.1 of the License, or diff --git a/src/java/com/samskivert/depot/annotation/GenerationType.java b/src/java/com/samskivert/depot/annotation/GenerationType.java index 1764006..a26b6fe 100644 --- a/src/java/com/samskivert/depot/annotation/GenerationType.java +++ b/src/java/com/samskivert/depot/annotation/GenerationType.java @@ -3,7 +3,7 @@ // // Depot library - a Java relational persistence library // Copyright (C) 2006-2008 Michael Bayne and Pär Winzell -// +// // This library is free software; you can redistribute it and/or modify it // under the terms of the GNU Lesser General Public License as published // by the Free Software Foundation; either version 2.1 of the License, or diff --git a/src/java/com/samskivert/depot/annotation/Id.java b/src/java/com/samskivert/depot/annotation/Id.java index f1b418f..88baaa6 100644 --- a/src/java/com/samskivert/depot/annotation/Id.java +++ b/src/java/com/samskivert/depot/annotation/Id.java @@ -3,7 +3,7 @@ // // Depot library - a Java relational persistence library // Copyright (C) 2006-2008 Michael Bayne and Pär Winzell -// +// // This library is free software; you can redistribute it and/or modify it // under the terms of the GNU Lesser General Public License as published // by the Free Software Foundation; either version 2.1 of the License, or diff --git a/src/java/com/samskivert/depot/annotation/TableGenerator.java b/src/java/com/samskivert/depot/annotation/TableGenerator.java index 1fdaaa4..258b92c 100644 --- a/src/java/com/samskivert/depot/annotation/TableGenerator.java +++ b/src/java/com/samskivert/depot/annotation/TableGenerator.java @@ -3,7 +3,7 @@ // // Depot library - a Java relational persistence library // Copyright (C) 2006-2008 Michael Bayne and Pär Winzell -// +// // This library is free software; you can redistribute it and/or modify it // under the terms of the GNU Lesser General Public License as published // by the Free Software Foundation; either version 2.1 of the License, or diff --git a/src/java/com/samskivert/depot/annotation/Transient.java b/src/java/com/samskivert/depot/annotation/Transient.java index e349d67..052516b 100644 --- a/src/java/com/samskivert/depot/annotation/Transient.java +++ b/src/java/com/samskivert/depot/annotation/Transient.java @@ -3,7 +3,7 @@ // // Depot library - a Java relational persistence library // Copyright (C) 2006-2008 Michael Bayne and Pär Winzell -// +// // This library is free software; you can redistribute it and/or modify it // under the terms of the GNU Lesser General Public License as published // by the Free Software Foundation; either version 2.1 of the License, or diff --git a/src/java/com/samskivert/depot/annotation/UniqueConstraint.java b/src/java/com/samskivert/depot/annotation/UniqueConstraint.java index a005dab..ccb1dfb 100644 --- a/src/java/com/samskivert/depot/annotation/UniqueConstraint.java +++ b/src/java/com/samskivert/depot/annotation/UniqueConstraint.java @@ -3,7 +3,7 @@ // // Depot library - a Java relational persistence library // Copyright (C) 2006-2008 Michael Bayne and Pär Winzell -// +// // This library is free software; you can redistribute it and/or modify it // under the terms of the GNU Lesser General Public License as published // by the Free Software Foundation; either version 2.1 of the License, or diff --git a/src/java/com/samskivert/depot/clause/FieldDefinition.java b/src/java/com/samskivert/depot/clause/FieldDefinition.java index a4d4b04..6804a94 100644 --- a/src/java/com/samskivert/depot/clause/FieldDefinition.java +++ b/src/java/com/samskivert/depot/clause/FieldDefinition.java @@ -3,7 +3,7 @@ // // Depot library - a Java relational persistence library // Copyright (C) 2006-2008 Michael Bayne and Pär Winzell -// +// // This library is free software; you can redistribute it and/or modify it // under the terms of the GNU Lesser General Public License as published // by the Free Software Foundation; either version 2.1 of the License, or diff --git a/src/java/com/samskivert/depot/clause/FieldOverride.java b/src/java/com/samskivert/depot/clause/FieldOverride.java index b767432..5ac0836 100644 --- a/src/java/com/samskivert/depot/clause/FieldOverride.java +++ b/src/java/com/samskivert/depot/clause/FieldOverride.java @@ -3,7 +3,7 @@ // // Depot library - a Java relational persistence library // Copyright (C) 2006-2008 Michael Bayne and Pär Winzell -// +// // This library is free software; you can redistribute it and/or modify it // under the terms of the GNU Lesser General Public License as published // by the Free Software Foundation; either version 2.1 of the License, or diff --git a/src/java/com/samskivert/depot/clause/ForUpdate.java b/src/java/com/samskivert/depot/clause/ForUpdate.java index 76df323..fa2c77a 100644 --- a/src/java/com/samskivert/depot/clause/ForUpdate.java +++ b/src/java/com/samskivert/depot/clause/ForUpdate.java @@ -3,7 +3,7 @@ // // Depot library - a Java relational persistence library // Copyright (C) 2006-2008 Michael Bayne and Pär Winzell -// +// // This library is free software; you can redistribute it and/or modify it // under the terms of the GNU Lesser General Public License as published // by the Free Software Foundation; either version 2.1 of the License, or diff --git a/src/java/com/samskivert/depot/clause/FromOverride.java b/src/java/com/samskivert/depot/clause/FromOverride.java index 109e10e..90b2cd3 100644 --- a/src/java/com/samskivert/depot/clause/FromOverride.java +++ b/src/java/com/samskivert/depot/clause/FromOverride.java @@ -3,7 +3,7 @@ // // Depot library - a Java relational persistence library // Copyright (C) 2006-2008 Michael Bayne and Pär Winzell -// +// // This library is free software; you can redistribute it and/or modify it // under the terms of the GNU Lesser General Public License as published // by the Free Software Foundation; either version 2.1 of the License, or diff --git a/src/java/com/samskivert/depot/clause/GroupBy.java b/src/java/com/samskivert/depot/clause/GroupBy.java index 242a75d..14cf118 100644 --- a/src/java/com/samskivert/depot/clause/GroupBy.java +++ b/src/java/com/samskivert/depot/clause/GroupBy.java @@ -3,7 +3,7 @@ // // Depot library - a Java relational persistence library // Copyright (C) 2006-2008 Michael Bayne and Pär Winzell -// +// // This library is free software; you can redistribute it and/or modify it // under the terms of the GNU Lesser General Public License as published // by the Free Software Foundation; either version 2.1 of the License, or diff --git a/src/java/com/samskivert/depot/clause/InsertClause.java b/src/java/com/samskivert/depot/clause/InsertClause.java index 3884004..e4f2e0d 100644 --- a/src/java/com/samskivert/depot/clause/InsertClause.java +++ b/src/java/com/samskivert/depot/clause/InsertClause.java @@ -3,7 +3,7 @@ // // Depot library - a Java relational persistence library // Copyright (C) 2006-2008 Michael Bayne and Pär Winzell -// +// // This library is free software; you can redistribute it and/or modify it // under the terms of the GNU Lesser General Public License as published // by the Free Software Foundation; either version 2.1 of the License, or diff --git a/src/java/com/samskivert/depot/clause/Join.java b/src/java/com/samskivert/depot/clause/Join.java index d57eb3c..63714d3 100644 --- a/src/java/com/samskivert/depot/clause/Join.java +++ b/src/java/com/samskivert/depot/clause/Join.java @@ -3,7 +3,7 @@ // // Depot library - a Java relational persistence library // Copyright (C) 2006-2008 Michael Bayne and Pär Winzell -// +// // This library is free software; you can redistribute it and/or modify it // under the terms of the GNU Lesser General Public License as published // by the Free Software Foundation; either version 2.1 of the License, or diff --git a/src/java/com/samskivert/depot/clause/Limit.java b/src/java/com/samskivert/depot/clause/Limit.java index 7e871bd..d2c5b9a 100644 --- a/src/java/com/samskivert/depot/clause/Limit.java +++ b/src/java/com/samskivert/depot/clause/Limit.java @@ -3,7 +3,7 @@ // // Depot library - a Java relational persistence library // Copyright (C) 2006-2008 Michael Bayne and Pär Winzell -// +// // This library is free software; you can redistribute it and/or modify it // under the terms of the GNU Lesser General Public License as published // by the Free Software Foundation; either version 2.1 of the License, or diff --git a/src/java/com/samskivert/depot/clause/OrderBy.java b/src/java/com/samskivert/depot/clause/OrderBy.java index 54a90ad..23344b0 100644 --- a/src/java/com/samskivert/depot/clause/OrderBy.java +++ b/src/java/com/samskivert/depot/clause/OrderBy.java @@ -3,7 +3,7 @@ // // Depot library - a Java relational persistence library // Copyright (C) 2006-2008 Michael Bayne and Pär Winzell -// +// // This library is free software; you can redistribute it and/or modify it // under the terms of the GNU Lesser General Public License as published // by the Free Software Foundation; either version 2.1 of the License, or diff --git a/src/java/com/samskivert/depot/clause/QueryClause.java b/src/java/com/samskivert/depot/clause/QueryClause.java index 95cea46..8466133 100644 --- a/src/java/com/samskivert/depot/clause/QueryClause.java +++ b/src/java/com/samskivert/depot/clause/QueryClause.java @@ -3,7 +3,7 @@ // // Depot library - a Java relational persistence library // Copyright (C) 2006-2008 Michael Bayne and Pär Winzell -// +// // This library is free software; you can redistribute it and/or modify it // under the terms of the GNU Lesser General Public License as published // by the Free Software Foundation; either version 2.1 of the License, or diff --git a/src/java/com/samskivert/depot/clause/SelectClause.java b/src/java/com/samskivert/depot/clause/SelectClause.java index 854af43..64a21f3 100644 --- a/src/java/com/samskivert/depot/clause/SelectClause.java +++ b/src/java/com/samskivert/depot/clause/SelectClause.java @@ -3,7 +3,7 @@ // // Depot library - a Java relational persistence library // Copyright (C) 2006-2008 Michael Bayne and Pär Winzell -// +// // This library is free software; you can redistribute it and/or modify it // under the terms of the GNU Lesser General Public License as published // by the Free Software Foundation; either version 2.1 of the License, or diff --git a/src/java/com/samskivert/depot/clause/Where.java b/src/java/com/samskivert/depot/clause/Where.java index f0b44a7..abb6e15 100644 --- a/src/java/com/samskivert/depot/clause/Where.java +++ b/src/java/com/samskivert/depot/clause/Where.java @@ -3,7 +3,7 @@ // // Depot library - a Java relational persistence library // Copyright (C) 2006-2008 Michael Bayne and Pär Winzell -// +// // This library is free software; you can redistribute it and/or modify it // under the terms of the GNU Lesser General Public License as published // by the Free Software Foundation; either version 2.1 of the License, or @@ -66,7 +66,7 @@ public class Where extends WhereClause _condition = condition; } - // from WhereClause + @Override // from WhereClause public SQLExpression getWhereExpression () { return _condition; diff --git a/src/java/com/samskivert/depot/clause/WhereClause.java b/src/java/com/samskivert/depot/clause/WhereClause.java index f66a004..a1dba08 100644 --- a/src/java/com/samskivert/depot/clause/WhereClause.java +++ b/src/java/com/samskivert/depot/clause/WhereClause.java @@ -3,7 +3,7 @@ // // Depot library - a Java relational persistence library // Copyright (C) 2006-2008 Michael Bayne and Pär Winzell -// +// // This library is free software; you can redistribute it and/or modify it // under the terms of the GNU Lesser General Public License as published // by the Free Software Foundation; either version 2.1 of the License, or diff --git a/src/java/com/samskivert/depot/expression/ColumnExp.java b/src/java/com/samskivert/depot/expression/ColumnExp.java index 762c876..3f7c746 100644 --- a/src/java/com/samskivert/depot/expression/ColumnExp.java +++ b/src/java/com/samskivert/depot/expression/ColumnExp.java @@ -3,7 +3,7 @@ // // Depot library - a Java relational persistence library // Copyright (C) 2006-2008 Michael Bayne and Pär Winzell -// +// // This library is free software; you can redistribute it and/or modify it // under the terms of the GNU Lesser General Public License as published // by the Free Software Foundation; either version 2.1 of the License, or diff --git a/src/java/com/samskivert/depot/expression/EpochSeconds.java b/src/java/com/samskivert/depot/expression/EpochSeconds.java index 8081fd0..1ce5f19 100644 --- a/src/java/com/samskivert/depot/expression/EpochSeconds.java +++ b/src/java/com/samskivert/depot/expression/EpochSeconds.java @@ -3,7 +3,7 @@ // // Depot library - a Java relational persistence library // Copyright (C) 2006-2008 Michael Bayne and Pär Winzell -// +// // This library is free software; you can redistribute it and/or modify it // under the terms of the GNU Lesser General Public License as published // by the Free Software Foundation; either version 2.1 of the License, or diff --git a/src/java/com/samskivert/depot/expression/FunctionExp.java b/src/java/com/samskivert/depot/expression/FunctionExp.java index 8788433..936fea1 100644 --- a/src/java/com/samskivert/depot/expression/FunctionExp.java +++ b/src/java/com/samskivert/depot/expression/FunctionExp.java @@ -3,7 +3,7 @@ // // Depot library - a Java relational persistence library // Copyright (C) 2006-2008 Michael Bayne and Pär Winzell -// +// // This library is free software; you can redistribute it and/or modify it // under the terms of the GNU Lesser General Public License as published // by the Free Software Foundation; either version 2.1 of the License, or @@ -50,8 +50,8 @@ public class FunctionExp implements SQLExpression // from SQLExpression public void addClasses (Collection> 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, ", ") + ")"; diff --git a/src/java/com/samskivert/depot/expression/LiteralExp.java b/src/java/com/samskivert/depot/expression/LiteralExp.java index c8b2749..538192e 100644 --- a/src/java/com/samskivert/depot/expression/LiteralExp.java +++ b/src/java/com/samskivert/depot/expression/LiteralExp.java @@ -3,7 +3,7 @@ // // Depot library - a Java relational persistence library // Copyright (C) 2006-2008 Michael Bayne and Pär Winzell -// +// // This library is free software; you can redistribute it and/or modify it // under the terms of the GNU Lesser General Public License as published // by the Free Software Foundation; either version 2.1 of the License, or @@ -53,6 +53,7 @@ public class LiteralExp return _text; } + @Override public String toString () { return _text; diff --git a/src/java/com/samskivert/depot/expression/SQLExpression.java b/src/java/com/samskivert/depot/expression/SQLExpression.java index 69f7a81..7425929 100644 --- a/src/java/com/samskivert/depot/expression/SQLExpression.java +++ b/src/java/com/samskivert/depot/expression/SQLExpression.java @@ -3,7 +3,7 @@ // // Depot library - a Java relational persistence library // Copyright (C) 2006-2008 Michael Bayne and Pär Winzell -// +// // This library is free software; you can redistribute it and/or modify it // under the terms of the GNU Lesser General Public License as published // by the Free Software Foundation; either version 2.1 of the License, or @@ -38,7 +38,7 @@ public interface SQLExpression _reason = reason; } - public String toString () { + @Override public String toString () { return "[unknown value, reason=" + _reason + "]"; } diff --git a/src/java/com/samskivert/depot/expression/ValueExp.java b/src/java/com/samskivert/depot/expression/ValueExp.java index 4de1265..3ada647 100644 --- a/src/java/com/samskivert/depot/expression/ValueExp.java +++ b/src/java/com/samskivert/depot/expression/ValueExp.java @@ -3,7 +3,7 @@ // // Depot library - a Java relational persistence library // Copyright (C) 2006-2008 Michael Bayne and Pär Winzell -// +// // This library is free software; you can redistribute it and/or modify it // under the terms of the GNU Lesser General Public License as published // by the Free Software Foundation; either version 2.1 of the License, or diff --git a/src/java/com/samskivert/depot/impl/DepotMarshaller.java b/src/java/com/samskivert/depot/impl/DepotMarshaller.java index 4723c2f..6b0d525 100644 --- a/src/java/com/samskivert/depot/impl/DepotMarshaller.java +++ b/src/java/com/samskivert/depot/impl/DepotMarshaller.java @@ -498,18 +498,18 @@ public class DepotMarshaller if (getTableName() == null) { return; } - + // figure out the list of fields that correspond to actual table columns and generate the // SQL used to create and migrate our table (unless we're a computed entity) _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 ++; } @@ -537,7 +537,7 @@ public class DepotMarshaller return 0; } }); - + // fetch all relevant information regarding our table from the database TableMetaData metaData = TableMetaData.load(ctx, getTableName()); @@ -547,6 +547,7 @@ public class DepotMarshaller 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 // 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 // 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 _newMigratingVersion = newMigratingVersion; _guardVersion = guardVersion; } + @Override protected int invoke (DatabaseLiaison liaison, Statement stmt) throws SQLException { return stmt.executeUpdate( "update " + liaison.tableSQL(SCHEMA_VERSION_TABLE) + @@ -1120,7 +1124,8 @@ public class DepotMarshaller pkColumns.add(rs.getString("COLUMN_NAME")); } } - + + @Override public String toString () { return StringUtil.fieldsToString(this); diff --git a/src/java/com/samskivert/depot/impl/DepotMigrationHistoryRecord.java b/src/java/com/samskivert/depot/impl/DepotMigrationHistoryRecord.java index 375721e..262adc4 100644 --- a/src/java/com/samskivert/depot/impl/DepotMigrationHistoryRecord.java +++ b/src/java/com/samskivert/depot/impl/DepotMigrationHistoryRecord.java @@ -3,7 +3,7 @@ // // Depot library - a Java relational persistence library // Copyright (C) 2006-2008 Michael Bayne and Pär Winzell -// +// // This library is free software; you can redistribute it and/or modify it // under the terms of the GNU Lesser General Public License as published // by the Free Software Foundation; either version 2.1 of the License, or diff --git a/src/java/com/samskivert/depot/impl/DepotUtil.java b/src/java/com/samskivert/depot/impl/DepotUtil.java index 8cf5480..9942e4b 100644 --- a/src/java/com/samskivert/depot/impl/DepotUtil.java +++ b/src/java/com/samskivert/depot/impl/DepotUtil.java @@ -3,7 +3,7 @@ // // Depot library - a Java relational persistence library // Copyright (C) 2006-2008 Michael Bayne and Pär Winzell -// +// // This library is free software; you can redistribute it and/or modify it // under the terms of the GNU Lesser General Public License as published // by the Free Software Foundation; either version 2.1 of the License, or diff --git a/src/java/com/samskivert/depot/impl/FieldMarshaller.java b/src/java/com/samskivert/depot/impl/FieldMarshaller.java index 5c38dc3..b09b8eb 100644 --- a/src/java/com/samskivert/depot/impl/FieldMarshaller.java +++ b/src/java/com/samskivert/depot/impl/FieldMarshaller.java @@ -3,7 +3,7 @@ // // Depot library - a Java relational persistence library // Copyright (C) 2006-2008 Michael Bayne and Pär Winzell -// +// // This library is free software; you can redistribute it and/or modify it // under the terms of the GNU Lesser General Public License as published // by the Free Software Foundation; either version 2.1 of the License, or @@ -409,7 +409,7 @@ public abstract class FieldMarshaller ByteBuffer bbuf = ByteBuffer.allocate(values.length * 4); bbuf.asIntBuffer().put(values); return bbuf.array(); - + } @Override public byte[] getFromSet (ResultSet rs) throws SQLException { diff --git a/src/java/com/samskivert/depot/impl/FindAllKeysQuery.java b/src/java/com/samskivert/depot/impl/FindAllKeysQuery.java index 3d7caf9..3d1b642 100644 --- a/src/java/com/samskivert/depot/impl/FindAllKeysQuery.java +++ b/src/java/com/samskivert/depot/impl/FindAllKeysQuery.java @@ -3,7 +3,7 @@ // // Depot library - a Java relational persistence library // Copyright (C) 2006-2008 Michael Bayne and Pär Winzell -// +// // This library is free software; you can redistribute it and/or modify it // under the terms of the GNU Lesser General Public License as published // by the Free Software Foundation; either version 2.1 of the License, or diff --git a/src/java/com/samskivert/depot/impl/FindAllQuery.java b/src/java/com/samskivert/depot/impl/FindAllQuery.java index 91e5423..97eaa04 100644 --- a/src/java/com/samskivert/depot/impl/FindAllQuery.java +++ b/src/java/com/samskivert/depot/impl/FindAllQuery.java @@ -91,11 +91,11 @@ public abstract class FindAllQuery extends Query