From 72b52d478b1aeccf17b4ba6132d4601aa30b0084 Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Mon, 7 Sep 2020 18:21:02 +0200 Subject: [PATCH] Polishing (backported from 5.2.x) --- .../jdbc/core/DisposableSqlTypeValue.java | 2 +- .../jdbc/core/JdbcOperations.java | 14 ++++++------ .../jdbc/core/JdbcTemplate.java | 10 ++++----- .../jdbc/core/ParameterDisposer.java | 2 +- .../jdbc/core/StatementCreatorUtils.java | 6 ++--- .../core/metadata/CallMetaDataContext.java | 2 +- .../core/metadata/CallParameterMetaData.java | 22 +++++++++---------- .../NamedParameterJdbcOperations.java | 8 +++---- .../jdbc/support/rowset/SqlRowSet.java | 4 ++-- 9 files changed, 35 insertions(+), 35 deletions(-) diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/DisposableSqlTypeValue.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/DisposableSqlTypeValue.java index 294bc817ec9..fb94d838fb2 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/DisposableSqlTypeValue.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/DisposableSqlTypeValue.java @@ -29,7 +29,7 @@ public interface DisposableSqlTypeValue extends SqlTypeValue { /** * Clean up resources held by this type value, - * for example the LobCreator in case of a SqlLobValue. + * for example the LobCreator in case of an SqlLobValue. * @see org.springframework.jdbc.core.support.SqlLobValue#cleanup() * @see org.springframework.jdbc.support.SqlValue#cleanup() */ diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/JdbcOperations.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/JdbcOperations.java index dc559b03d52..d7e9f9ff0c4 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/JdbcOperations.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/JdbcOperations.java @@ -223,7 +223,7 @@ public interface JdbcOperations { List> queryForList(String sql) throws DataAccessException; /** - * Execute a query for a SqlRowSet, given static SQL. + * Execute a query for an SqlRowSet, given static SQL. *

Uses a JDBC Statement, not a PreparedStatement. If you want to * execute a static query with a PreparedStatement, use the overloaded * {@code queryForRowSet} method with {@code null} as argument array. @@ -234,7 +234,7 @@ public interface JdbcOperations { * class is used, which is part of JDK 1.5+ and also available separately as part of * Sun's JDBC RowSet Implementations download (rowset.jar). * @param sql the SQL query to execute - * @return a SqlRowSet representation (possibly a wrapper around a + * @return an SqlRowSet representation (possibly a wrapper around a * {@code javax.sql.rowset.CachedRowSet}) * @throws DataAccessException if there is any problem executing the query * @see #queryForRowSet(String, Object...) @@ -775,7 +775,7 @@ public interface JdbcOperations { /** * Query given SQL to create a prepared statement from SQL and a list of - * arguments to bind to the query, expecting a SqlRowSet. + * arguments to bind to the query, expecting an SqlRowSet. *

The results will be mapped to an SqlRowSet which holds the data in a * disconnected fashion. This wrapper will translate any SQLExceptions thrown. *

Note that, for the default implementation, JDBC RowSet support needs to @@ -786,7 +786,7 @@ public interface JdbcOperations { * @param args arguments to bind to the query * @param argTypes the SQL types of the arguments * (constants from {@code java.sql.Types}) - * @return a SqlRowSet representation (possibly a wrapper around a + * @return an SqlRowSet representation (possibly a wrapper around a * {@code javax.sql.rowset.CachedRowSet}) * @throws DataAccessException if there is any problem executing the query * @see #queryForRowSet(String) @@ -798,7 +798,7 @@ public interface JdbcOperations { /** * Query given SQL to create a prepared statement from SQL and a list of - * arguments to bind to the query, expecting a SqlRowSet. + * arguments to bind to the query, expecting an SqlRowSet. *

The results will be mapped to an SqlRowSet which holds the data in a * disconnected fashion. This wrapper will translate any SQLExceptions thrown. *

Note that, for the default implementation, JDBC RowSet support needs to @@ -810,7 +810,7 @@ public interface JdbcOperations { * (leaving it to the PreparedStatement to guess the corresponding SQL type); * may also contain {@link SqlParameterValue} objects which indicate not * only the argument value but also the SQL type and optionally the scale - * @return a SqlRowSet representation (possibly a wrapper around a + * @return an SqlRowSet representation (possibly a wrapper around a * {@code javax.sql.rowset.CachedRowSet}) * @throws DataAccessException if there is any problem executing the query * @see #queryForRowSet(String) @@ -974,7 +974,7 @@ public interface JdbcOperations { T execute(String callString, CallableStatementCallback action) throws DataAccessException; /** - * Execute a SQL call using a CallableStatementCreator to provide SQL and + * Execute an SQL call using a CallableStatementCreator to provide SQL and * any required parameters. * @param csc a callback that provides SQL and any necessary parameters * @param declaredParameters list of declared SqlParameter objects diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/JdbcTemplate.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/JdbcTemplate.java index 819fff30f00..a06f04e659b 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/JdbcTemplate.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/JdbcTemplate.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2020 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. @@ -182,7 +182,7 @@ public class JdbcTemplate extends JdbcAccessor implements JdbcOperations { /** * Set whether or not we want to ignore SQLWarnings. *

Default is "true", swallowing and logging all warnings. Switch this flag - * to "false" to make the JdbcTemplate throw a SQLWarningException instead. + * to "false" to make the JdbcTemplate throw an SQLWarningException instead. * @see java.sql.SQLWarning * @see org.springframework.jdbc.SQLWarningException * @see #handleWarnings @@ -1350,7 +1350,7 @@ public class JdbcTemplate extends JdbcAccessor implements JdbcOperations { } /** - * Throw a SQLWarningException if we're not ignoring warnings, + * Throw an SQLWarningException if we're not ignoring warnings, * otherwise log the warnings at debug level. * @param stmt the current JDBC statement * @throws SQLWarningException if not ignoring warnings @@ -1373,7 +1373,7 @@ public class JdbcTemplate extends JdbcAccessor implements JdbcOperations { } /** - * Throw a SQLWarningException if encountering an actual warning. + * Throw an SQLWarningException if encountering an actual warning. * @param warning the warnings object from the current statement. * May be {@code null}, in which case this method does nothing. * @throws SQLWarningException in case of an actual warning to be raised @@ -1401,7 +1401,7 @@ public class JdbcTemplate extends JdbcAccessor implements JdbcOperations { /** * Determine SQL from potential provider object. - * @param sqlProvider object which is potentially a SqlProvider + * @param sqlProvider object which is potentially an SqlProvider * @return the SQL string, or {@code null} if not known * @see SqlProvider */ diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/ParameterDisposer.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/ParameterDisposer.java index ba2f1fa3e33..56b669a9c46 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/ParameterDisposer.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/ParameterDisposer.java @@ -37,7 +37,7 @@ public interface ParameterDisposer { /** * Close the resources allocated by parameters that the implementing * object holds, for example in case of a DisposableSqlTypeValue - * (like a SqlLobValue). + * (like an SqlLobValue). * @see DisposableSqlTypeValue#cleanup() * @see org.springframework.jdbc.core.support.SqlLobValue#cleanup() */ diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/StatementCreatorUtils.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/StatementCreatorUtils.java index e3562f3eedd..5c6c1d859d2 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/StatementCreatorUtils.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/StatementCreatorUtils.java @@ -152,7 +152,7 @@ public abstract class StatementCreatorUtils { * @param ps the prepared statement or callable statement * @param paramIndex index of the parameter we are setting * @param sqlType the SQL type of the parameter - * @param inValue the value to set (plain value or a SqlTypeValue) + * @param inValue the value to set (plain value or an SqlTypeValue) * @throws SQLException if thrown by PreparedStatement methods * @see SqlTypeValue */ @@ -170,7 +170,7 @@ public abstract class StatementCreatorUtils { * @param sqlType the SQL type of the parameter * @param typeName the type name of the parameter * (optional, only used for SQL NULL and SqlTypeValue) - * @param inValue the value to set (plain value or a SqlTypeValue) + * @param inValue the value to set (plain value or an SqlTypeValue) * @throws SQLException if thrown by PreparedStatement methods * @see SqlTypeValue */ @@ -190,7 +190,7 @@ public abstract class StatementCreatorUtils { * (optional, only used for SQL NULL and SqlTypeValue) * @param scale the number of digits after the decimal point * (for DECIMAL and NUMERIC types) - * @param inValue the value to set (plain value or a SqlTypeValue) + * @param inValue the value to set (plain value or an SqlTypeValue) * @throws SQLException if thrown by PreparedStatement methods * @see SqlTypeValue */ diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/CallMetaDataContext.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/CallMetaDataContext.java index 6c32de78db8..53af1f04a61 100755 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/CallMetaDataContext.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/CallMetaDataContext.java @@ -390,7 +390,7 @@ public class CallMetaDataContext { if (param == null) { throw new InvalidDataAccessApiUsageException( "Unable to locate declared parameter for function return value - " + - " add a SqlOutParameter with name '" + getFunctionReturnName() + "'"); + " add an SqlOutParameter with name '" + getFunctionReturnName() + "'"); } else { this.actualFunctionReturnName = param.getName(); diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/CallParameterMetaData.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/CallParameterMetaData.java index 53eae916342..0ec1a8e50c5 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/CallParameterMetaData.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/CallParameterMetaData.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2018 the original author or authors. + * Copyright 2002-2020 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. @@ -31,16 +31,16 @@ import org.springframework.lang.Nullable; public class CallParameterMetaData { @Nullable - private String parameterName; + private final String parameterName; - private int parameterType; + private final int parameterType; - private int sqlType; + private final int sqlType; @Nullable - private String typeName; + private final String typeName; - private boolean nullable; + private final boolean nullable; /** @@ -58,7 +58,7 @@ public class CallParameterMetaData { /** - * Get the parameter name. + * Return the parameter name. */ @Nullable public String getParameterName() { @@ -66,7 +66,7 @@ public class CallParameterMetaData { } /** - * Get the parameter type. + * Return the parameter type. */ public int getParameterType() { return this.parameterType; @@ -84,14 +84,14 @@ public class CallParameterMetaData { } /** - * Get the parameter SQL type. + * Return the parameter SQL type. */ public int getSqlType() { return this.sqlType; } /** - * Get the parameter type name. + * Return the parameter type name. */ @Nullable public String getTypeName() { @@ -99,7 +99,7 @@ public class CallParameterMetaData { } /** - * Get whether the parameter is nullable. + * Return whether the parameter is nullable. */ public boolean isNullable() { return this.nullable; diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/namedparam/NamedParameterJdbcOperations.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/namedparam/NamedParameterJdbcOperations.java index d37abe95c12..ad5c627eeb8 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/namedparam/NamedParameterJdbcOperations.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/namedparam/NamedParameterJdbcOperations.java @@ -406,7 +406,7 @@ public interface NamedParameterJdbcOperations { /** * Query given SQL to create a prepared statement from SQL and a - * list of arguments to bind to the query, expecting a SqlRowSet. + * list of arguments to bind to the query, expecting an SqlRowSet. *

The results will be mapped to an SqlRowSet which holds the data in a * disconnected fashion. This wrapper will translate any SQLExceptions thrown. *

Note that, for the default implementation, JDBC RowSet support needs to @@ -415,7 +415,7 @@ public interface NamedParameterJdbcOperations { * Sun's JDBC RowSet Implementations download (rowset.jar). * @param sql the SQL query to execute * @param paramSource container of arguments to bind to the query - * @return a SqlRowSet representation (possibly a wrapper around a + * @return an SqlRowSet representation (possibly a wrapper around a * {@code javax.sql.rowset.CachedRowSet}) * @throws DataAccessException if there is any problem executing the query * @see org.springframework.jdbc.core.JdbcTemplate#queryForRowSet(String) @@ -426,7 +426,7 @@ public interface NamedParameterJdbcOperations { /** * Query given SQL to create a prepared statement from SQL and a - * list of arguments to bind to the query, expecting a SqlRowSet. + * list of arguments to bind to the query, expecting an SqlRowSet. *

The results will be mapped to an SqlRowSet which holds the data in a * disconnected fashion. This wrapper will translate any SQLExceptions thrown. *

Note that, for the default implementation, JDBC RowSet support needs to @@ -436,7 +436,7 @@ public interface NamedParameterJdbcOperations { * @param sql the SQL query to execute * @param paramMap map of parameters to bind to the query * (leaving it to the PreparedStatement to guess the corresponding SQL type) - * @return a SqlRowSet representation (possibly a wrapper around a + * @return an SqlRowSet representation (possibly a wrapper around a * {@code javax.sql.rowset.CachedRowSet}) * @throws DataAccessException if there is any problem executing the query * @see org.springframework.jdbc.core.JdbcTemplate#queryForRowSet(String) diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/support/rowset/SqlRowSet.java b/spring-jdbc/src/main/java/org/springframework/jdbc/support/rowset/SqlRowSet.java index f0257f7b0e7..cb49fd0597a 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/support/rowset/SqlRowSet.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/support/rowset/SqlRowSet.java @@ -32,8 +32,8 @@ import org.springframework.lang.Nullable; * {@link java.sql.ResultSet} data. * *

The main difference to the standard JDBC RowSet is that a {@link java.sql.SQLException} - * is never thrown here. This allows a SqlRowSet to be used without having to deal with - * checked exceptions. A SqlRowSet will throw Spring's {@link InvalidResultSetAccessException} + * is never thrown here. This allows an SqlRowSet to be used without having to deal with + * checked exceptions. An SqlRowSet will throw Spring's {@link InvalidResultSetAccessException} * instead (when appropriate). * *

Note: This interface extends the {@code java.io.Serializable} marker interface.