Browse Source

closed Java 5 code style gaps

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@350 50f2f4bb-b051-0410-bef5-90022cba6387
pull/1/head
Juergen Hoeller 17 years ago
parent
commit
b9697b2306
  1. 12
      org.springframework.jdbc/src/main/java/org/springframework/jdbc/core/JdbcOperations.java
  2. 12
      org.springframework.jdbc/src/main/java/org/springframework/jdbc/core/JdbcTemplate.java
  3. 2
      org.springframework.jdbc/src/main/java/org/springframework/jdbc/core/metadata/CallMetaDataContext.java
  4. 13
      org.springframework.jdbc/src/main/java/org/springframework/jdbc/core/simple/AbstractJdbcCall.java
  5. 10
      org.springframework.jdbc/src/main/java/org/springframework/jdbc/datasource/AbstractDataSource.java
  6. 8
      org.springframework.jdbc/src/main/java/org/springframework/jdbc/datasource/DelegatingDataSource.java
  7. 7
      org.springframework.jdbc/src/main/java/org/springframework/jdbc/object/SqlUpdate.java
  8. 7
      org.springframework.jdbc/src/main/java/org/springframework/jdbc/object/StoredProcedure.java

12
org.springframework.jdbc/src/main/java/org/springframework/jdbc/core/JdbcOperations.java

@ -613,7 +613,7 @@ public interface JdbcOperations { @@ -613,7 +613,7 @@ public interface JdbcOperations {
* @see #queryForMap(String)
* @see ColumnMapRowMapper
*/
Map<String, Object> queryForMap(String sql, Object[] args) throws DataAccessException;
Map<String, Object> queryForMap(String sql, Object... args) throws DataAccessException;
/**
* Query given SQL to create a prepared statement from SQL and a
@ -649,7 +649,7 @@ public interface JdbcOperations { @@ -649,7 +649,7 @@ public interface JdbcOperations {
* @throws DataAccessException if the query fails
* @see #queryForLong(String)
*/
long queryForLong(String sql, Object[] args) throws DataAccessException;
long queryForLong(String sql, Object... args) throws DataAccessException;
/**
* Query given SQL to create a prepared statement from SQL and a
@ -685,7 +685,7 @@ public interface JdbcOperations { @@ -685,7 +685,7 @@ public interface JdbcOperations {
* @throws DataAccessException if the query fails
* @see #queryForInt(String)
*/
int queryForInt(String sql, Object[] args) throws DataAccessException;
int queryForInt(String sql, Object... args) throws DataAccessException;
/**
* Query given SQL to create a prepared statement from SQL and a
@ -759,7 +759,7 @@ public interface JdbcOperations { @@ -759,7 +759,7 @@ public interface JdbcOperations {
* @throws DataAccessException if the query fails
* @see #queryForList(String)
*/
List<Map<String, Object>> queryForList(String sql, Object[] args) throws DataAccessException;
List<Map<String, Object>> queryForList(String sql, Object... args) throws DataAccessException;
/**
* Query given SQL to create a prepared statement from SQL and a
@ -805,7 +805,7 @@ public interface JdbcOperations { @@ -805,7 +805,7 @@ public interface JdbcOperations {
* @see SqlRowSetResultSetExtractor
* @see javax.sql.rowset.CachedRowSet
*/
SqlRowSet queryForRowSet(String sql, Object[] args) throws DataAccessException;
SqlRowSet queryForRowSet(String sql, Object... args) throws DataAccessException;
/**
* Issue a single SQL update operation (such as an insert, update or delete statement)
@ -871,7 +871,7 @@ public interface JdbcOperations { @@ -871,7 +871,7 @@ public interface JdbcOperations {
* @return the number of rows affected
* @throws DataAccessException if there is any problem issuing the update
*/
int update(String sql, Object[] args) throws DataAccessException;
int update(String sql, Object... args) throws DataAccessException;
/**
* Issue multiple update statements on a single PreparedStatement,

12
org.springframework.jdbc/src/main/java/org/springframework/jdbc/core/JdbcTemplate.java

@ -731,7 +731,7 @@ public class JdbcTemplate extends JdbcAccessor implements JdbcOperations { @@ -731,7 +731,7 @@ public class JdbcTemplate extends JdbcAccessor implements JdbcOperations {
return queryForObject(sql, args, argTypes, getColumnMapRowMapper());
}
public Map<String, Object> queryForMap(String sql, Object[] args) throws DataAccessException {
public Map<String, Object> queryForMap(String sql, Object... args) throws DataAccessException {
return queryForObject(sql, args, getColumnMapRowMapper());
}
@ -740,7 +740,7 @@ public class JdbcTemplate extends JdbcAccessor implements JdbcOperations { @@ -740,7 +740,7 @@ public class JdbcTemplate extends JdbcAccessor implements JdbcOperations {
return (number != null ? number.longValue() : 0);
}
public long queryForLong(String sql, Object[] args) throws DataAccessException {
public long queryForLong(String sql, Object... args) throws DataAccessException {
Number number = queryForObject(sql, args, Long.class);
return (number != null ? number.longValue() : 0);
}
@ -750,7 +750,7 @@ public class JdbcTemplate extends JdbcAccessor implements JdbcOperations { @@ -750,7 +750,7 @@ public class JdbcTemplate extends JdbcAccessor implements JdbcOperations {
return (number != null ? number.intValue() : 0);
}
public int queryForInt(String sql, Object[] args) throws DataAccessException {
public int queryForInt(String sql, Object... args) throws DataAccessException {
Number number = queryForObject(sql, args, Integer.class);
return (number != null ? number.intValue() : 0);
}
@ -767,7 +767,7 @@ public class JdbcTemplate extends JdbcAccessor implements JdbcOperations { @@ -767,7 +767,7 @@ public class JdbcTemplate extends JdbcAccessor implements JdbcOperations {
return query(sql, args, argTypes, getColumnMapRowMapper());
}
public List<Map<String, Object>> queryForList(String sql, Object[] args) throws DataAccessException {
public List<Map<String, Object>> queryForList(String sql, Object... args) throws DataAccessException {
return query(sql, args, getColumnMapRowMapper());
}
@ -775,7 +775,7 @@ public class JdbcTemplate extends JdbcAccessor implements JdbcOperations { @@ -775,7 +775,7 @@ public class JdbcTemplate extends JdbcAccessor implements JdbcOperations {
return query(sql, args, argTypes, new SqlRowSetResultSetExtractor());
}
public SqlRowSet queryForRowSet(String sql, Object[] args) throws DataAccessException {
public SqlRowSet queryForRowSet(String sql, Object... args) throws DataAccessException {
return query(sql, args, new SqlRowSetResultSetExtractor());
}
@ -846,7 +846,7 @@ public class JdbcTemplate extends JdbcAccessor implements JdbcOperations { @@ -846,7 +846,7 @@ public class JdbcTemplate extends JdbcAccessor implements JdbcOperations {
return update(sql, new ArgTypePreparedStatementSetter(args, argTypes));
}
public int update(String sql, Object[] args) throws DataAccessException {
public int update(String sql, Object... args) throws DataAccessException {
return update(sql, new ArgPreparedStatementSetter(args));
}

2
org.springframework.jdbc/src/main/java/org/springframework/jdbc/core/metadata/CallMetaDataContext.java

@ -484,7 +484,7 @@ public class CallMetaDataContext { @@ -484,7 +484,7 @@ public class CallMetaDataContext {
* @param inParameters the input values
* @return a Map containing the matched parameter names with the value taken from the input
*/
public Map<String, Object> matchInParameterValuesWithCallParameters(Map<String, Object> inParameters) {
public Map<String, ?> matchInParameterValuesWithCallParameters(Map<String, ?> inParameters) {
if (!this.metaDataProvider.isProcedureColumnMetaDataUsed()) {
return inParameters;
}

13
org.springframework.jdbc/src/main/java/org/springframework/jdbc/core/simple/AbstractJdbcCall.java

@ -21,7 +21,6 @@ import java.util.LinkedHashMap; @@ -21,7 +21,6 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.sql.DataSource;
import org.apache.commons.logging.Log;
@ -50,7 +49,7 @@ public abstract class AbstractJdbcCall { @@ -50,7 +49,7 @@ public abstract class AbstractJdbcCall {
protected final Log logger = LogFactory.getLog(getClass());
/** Lower-level class used to execute SQL */
private JdbcTemplate jdbcTemplate = new JdbcTemplate();
private final JdbcTemplate jdbcTemplate;
/** List of SqlParameter objects */
private final List<SqlParameter> declaredParameters = new ArrayList<SqlParameter>();
@ -338,7 +337,7 @@ public abstract class AbstractJdbcCall { @@ -338,7 +337,7 @@ public abstract class AbstractJdbcCall {
*/
protected Map<String, Object> doExecute(SqlParameterSource parameterSource) {
checkCompiled();
Map params = matchInParameterValuesWithCallParameters(parameterSource);
Map<String, Object> params = matchInParameterValuesWithCallParameters(parameterSource);
return executeCallInternal(params);
}
@ -347,16 +346,16 @@ public abstract class AbstractJdbcCall { @@ -347,16 +346,16 @@ public abstract class AbstractJdbcCall {
* @param args Map of parameter name and values
* @return Map of out parameters
*/
protected Map<String, Object> doExecute(Map<String, Object> args) {
protected Map<String, Object> doExecute(Map<String, ?> args) {
checkCompiled();
Map params = matchInParameterValuesWithCallParameters(args);
Map<String, ?> params = matchInParameterValuesWithCallParameters(args);
return executeCallInternal(params);
}
/**
* Method to perform the actual call processing
*/
private Map<String, Object> executeCallInternal(Map params) {
private Map<String, Object> executeCallInternal(Map<String, ?> params) {
CallableStatementCreator csc = getCallableStatementFactory().newCallableStatementCreator(params);
if (logger.isDebugEnabled()) {
logger.debug("The following parameters are used for call " + getCallString() + " with: " + params);
@ -392,7 +391,7 @@ public abstract class AbstractJdbcCall { @@ -392,7 +391,7 @@ public abstract class AbstractJdbcCall {
* @param args the parameter values provided in a Map
* @return Map with parameter names and values
*/
protected Map<String, Object> matchInParameterValuesWithCallParameters(Map<String, Object> args) {
protected Map<String, ?> matchInParameterValuesWithCallParameters(Map<String, ?> args) {
return this.callMetaDataContext.matchInParameterValuesWithCallParameters(args);
}

10
org.springframework.jdbc/src/main/java/org/springframework/jdbc/datasource/AbstractDataSource.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2007 the original author or authors.
* Copyright 2002-2008 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -18,7 +18,6 @@ package org.springframework.jdbc.datasource; @@ -18,7 +18,6 @@ package org.springframework.jdbc.datasource;
import java.io.PrintWriter;
import java.sql.SQLException;
import javax.sql.DataSource;
import org.apache.commons.logging.Log;
@ -77,16 +76,17 @@ public abstract class AbstractDataSource implements DataSource { @@ -77,16 +76,17 @@ public abstract class AbstractDataSource implements DataSource {
// Implementation of JDBC 4.0's Wrapper interface
//---------------------------------------------------------------------
public Object unwrap(Class iface) throws SQLException {
@SuppressWarnings("unchecked")
public <T> T unwrap(Class<T> iface) throws SQLException {
Assert.notNull(iface, "Interface argument must not be null");
if (!DataSource.class.equals(iface)) {
throw new SQLException("DataSource of type [" + getClass().getName() +
"] can only be unwrapped as [javax.sql.DataSource], not as [" + iface.getName());
}
return this;
return (T) this;
}
public boolean isWrapperFor(Class iface) throws SQLException {
public boolean isWrapperFor(Class<?> iface) throws SQLException {
return DataSource.class.equals(iface);
}

8
org.springframework.jdbc/src/main/java/org/springframework/jdbc/datasource/DelegatingDataSource.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2007 the original author or authors.
* Copyright 2002-2008 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -19,7 +19,6 @@ package org.springframework.jdbc.datasource; @@ -19,7 +19,6 @@ package org.springframework.jdbc.datasource;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.SQLException;
import javax.sql.DataSource;
import org.springframework.beans.factory.InitializingBean;
@ -109,11 +108,12 @@ public class DelegatingDataSource implements DataSource, InitializingBean { @@ -109,11 +108,12 @@ public class DelegatingDataSource implements DataSource, InitializingBean {
// Implementation of JDBC 4.0's Wrapper interface
//---------------------------------------------------------------------
public Object unwrap(Class iface) throws SQLException {
@SuppressWarnings("unchecked")
public <T> T unwrap(Class<T> iface) throws SQLException {
return getTargetDataSource().unwrap(iface);
}
public boolean isWrapperFor(Class iface) throws SQLException {
public boolean isWrapperFor(Class<?> iface) throws SQLException {
return getTargetDataSource().isWrapperFor(iface);
}

7
org.springframework.jdbc/src/main/java/org/springframework/jdbc/object/SqlUpdate.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2007 the original author or authors.
* Copyright 2002-2008 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -17,7 +17,6 @@ @@ -17,7 +17,6 @@
package org.springframework.jdbc.object;
import java.util.Map;
import javax.sql.DataSource;
import org.springframework.dao.DataAccessException;
@ -240,7 +239,7 @@ public class SqlUpdate extends SqlOperation { @@ -240,7 +239,7 @@ public class SqlUpdate extends SqlOperation {
* matching named parameters specified in the SQL statement
* @return the number of rows affected by the update
*/
public int updateByNamedParam(Map paramMap) throws DataAccessException {
public int updateByNamedParam(Map<String, ?> paramMap) throws DataAccessException {
validateNamedParameters(paramMap);
ParsedSql parsedSql = getParsedSql();
MapSqlParameterSource paramSource = new MapSqlParameterSource(paramMap);
@ -259,7 +258,7 @@ public class SqlUpdate extends SqlOperation { @@ -259,7 +258,7 @@ public class SqlUpdate extends SqlOperation {
* @param generatedKeyHolder KeyHolder that will hold the generated keys
* @return the number of rows affected by the update
*/
public int updateByNamedParam(Map paramMap, KeyHolder generatedKeyHolder) throws DataAccessException {
public int updateByNamedParam(Map<String, ?> paramMap, KeyHolder generatedKeyHolder) throws DataAccessException {
validateNamedParameters(paramMap);
ParsedSql parsedSql = getParsedSql();
MapSqlParameterSource paramSource = new MapSqlParameterSource(paramMap);

7
org.springframework.jdbc/src/main/java/org/springframework/jdbc/object/StoredProcedure.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2006 the original author or authors.
* Copyright 2002-2008 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -17,7 +17,6 @@ @@ -17,7 +17,6 @@
package org.springframework.jdbc.object;
import java.util.Map;
import javax.sql.DataSource;
import org.springframework.dao.DataAccessException;
@ -114,7 +113,7 @@ public abstract class StoredProcedure extends SqlCall { @@ -114,7 +113,7 @@ public abstract class StoredProcedure extends SqlCall {
* Output parameters will appear here, with their values after the
* stored procedure has been called.
*/
public Map execute(Map inParams) throws DataAccessException {
public Map<String, Object> execute(Map<String, ?> inParams) throws DataAccessException {
validateParameters(inParams.values().toArray());
return getJdbcTemplate().call(newCallableStatementCreator(inParams), getDeclaredParameters());
}
@ -135,7 +134,7 @@ public abstract class StoredProcedure extends SqlCall { @@ -135,7 +134,7 @@ public abstract class StoredProcedure extends SqlCall {
* Output parameters will appear here, with their values after the
* stored procedure has been called.
*/
public Map execute(ParameterMapper inParamMapper) throws DataAccessException {
public Map<String, Object> execute(ParameterMapper inParamMapper) throws DataAccessException {
checkCompiled();
return getJdbcTemplate().call(newCallableStatementCreator(inParamMapper), getDeclaredParameters());
}

Loading…
Cancel
Save