Covariance here makes it easier to use ImmutableMap.

This commit is contained in:
Michael Bayne
2009-05-27 17:35:04 +00:00
parent a765645307
commit c8e5a3b413
@@ -739,7 +739,8 @@ public abstract class DepotRepository
* @throws DatabaseException if any problem is encountered communicating with the database. * @throws DatabaseException if any problem is encountered communicating with the database.
*/ */
protected <T extends PersistentRecord> int updateLiteral ( protected <T extends PersistentRecord> int updateLiteral (
Class<T> type, Comparable<?> primaryKey, Map<ColumnExp, SQLExpression> fieldsValues) Class<T> type, Comparable<?> primaryKey,
Map<ColumnExp, ? extends SQLExpression> fieldsValues)
throws DatabaseException throws DatabaseException
{ {
Key<T> key = _ctx.getMarshaller(type).makePrimaryKey(primaryKey); Key<T> key = _ctx.getMarshaller(type).makePrimaryKey(primaryKey);
@@ -767,7 +768,7 @@ public abstract class DepotRepository
*/ */
protected <T extends PersistentRecord> int updateLiteral ( protected <T extends PersistentRecord> int updateLiteral (
Class<T> type, ColumnExp ix1, Comparable<?> val1, ColumnExp ix2, Comparable<?> val2, Class<T> type, ColumnExp ix1, Comparable<?> val1, ColumnExp ix2, Comparable<?> val2,
Map<ColumnExp, SQLExpression> fieldsValues) Map<ColumnExp, ? extends SQLExpression> fieldsValues)
throws DatabaseException throws DatabaseException
{ {
Key<T> key = new Key<T>(type, ix1, val1, ix2, val2); Key<T> key = new Key<T>(type, ix1, val1, ix2, val2);
@@ -796,7 +797,7 @@ public abstract class DepotRepository
*/ */
protected <T extends PersistentRecord> int updateLiteral ( protected <T extends PersistentRecord> int updateLiteral (
Class<T> type, ColumnExp ix1, Comparable<?> val1, ColumnExp ix2, Comparable<?> val2, Class<T> type, ColumnExp ix1, Comparable<?> val1, ColumnExp ix2, Comparable<?> val2,
ColumnExp ix3, Comparable<?> val3, Map<ColumnExp, SQLExpression> fieldsValues) ColumnExp ix3, Comparable<?> val3, Map<ColumnExp, ? extends SQLExpression> fieldsValues)
throws DatabaseException throws DatabaseException
{ {
Key<T> key = new Key<T>(type, ix1, val1, ix2, val2, ix3, val3); Key<T> key = new Key<T>(type, ix1, val1, ix2, val2, ix3, val3);
@@ -826,7 +827,7 @@ public abstract class DepotRepository
*/ */
protected <T extends PersistentRecord> int updateLiteral ( protected <T extends PersistentRecord> int updateLiteral (
Class<T> type, final WhereClause key, CacheInvalidator invalidator, Class<T> type, final WhereClause key, CacheInvalidator invalidator,
Map<ColumnExp, SQLExpression> fieldsValues) Map<ColumnExp, ? extends SQLExpression> fieldsValues)
throws DatabaseException throws DatabaseException
{ {
requireNotComputed(type, "updateLiteral"); requireNotComputed(type, "updateLiteral");
@@ -840,7 +841,7 @@ public abstract class DepotRepository
final String[] fields = new String[fieldsValues.size()]; final String[] fields = new String[fieldsValues.size()];
final SQLExpression[] values = new SQLExpression[fields.length]; final SQLExpression[] values = new SQLExpression[fields.length];
int ii = 0; int ii = 0;
for (Map.Entry<ColumnExp, SQLExpression> entry : fieldsValues.entrySet()) { for (Map.Entry<ColumnExp, ? extends SQLExpression> entry : fieldsValues.entrySet()) {
fields[ii] = entry.getKey().name; fields[ii] = entry.getKey().name;
values[ii] = entry.getValue(); values[ii] = entry.getValue();
ii ++; ii ++;