Replace 'e.g.' with 'for example' in documentation and comments

Closes gh-33515
This commit is contained in:
Yanming Zhou
2024-09-26 14:03:46 +02:00
committed by Sam Brannen
parent e55fe9077f
commit 8941e2876e
722 changed files with 1290 additions and 1290 deletions

View File

@@ -148,7 +148,7 @@ public interface JdbcOperations {
* @param sql the SQL query to execute
* @param rowMapper a callback that will map one object per row
* @return the result Stream, containing mapped objects, needing to be
* closed once fully processed (e.g. through a try-with-resources clause)
* closed once fully processed (for example, through a try-with-resources clause)
* @throws DataAccessException if there is any problem executing the query
* @since 5.3
* @see #queryForStream(String, RowMapper, Object...)
@@ -554,7 +554,7 @@ public interface JdbcOperations {
* @param psc a callback that creates a PreparedStatement given a Connection
* @param rowMapper a callback that will map one object per row
* @return the result Stream, containing mapped objects, needing to be
* closed once fully processed (e.g. through a try-with-resources clause)
* closed once fully processed (for example, through a try-with-resources clause)
* @throws DataAccessException if there is any problem
* @see PreparedStatementCreatorFactory
* @since 5.3
@@ -573,7 +573,7 @@ public interface JdbcOperations {
* fetch size and other performance options.
* @param rowMapper a callback that will map one object per row
* @return the result Stream, containing mapped objects, needing to be
* closed once fully processed (e.g. through a try-with-resources clause)
* closed once fully processed (for example, through a try-with-resources clause)
* @throws DataAccessException if the query fails
* @since 5.3
*/
@@ -591,7 +591,7 @@ public interface JdbcOperations {
* may also contain {@link SqlParameterValue} objects which indicate not
* only the argument value but also the SQL type and optionally the scale
* @return the result Stream, containing mapped objects, needing to be
* closed once fully processed (e.g. through a try-with-resources clause)
* closed once fully processed (for example, through a try-with-resources clause)
* @throws DataAccessException if the query fails
* @since 5.3
*/

View File

@@ -225,7 +225,7 @@ public class JdbcTemplate extends JdbcAccessor implements JdbcOperations {
* <p>Default is -1, indicating to use the JDBC driver's default configuration
* (i.e. to not pass a specific fetch size setting on to the driver).
* <p>Note: As of 4.3, negative values other than -1 will get passed on to the
* driver, since e.g. MySQL supports special behavior for {@code Integer.MIN_VALUE}.
* driver, since, for example, MySQL supports special behavior for {@code Integer.MIN_VALUE}.
* @see java.sql.Statement#setFetchSize
*/
public void setFetchSize(int fetchSize) {
@@ -834,7 +834,7 @@ public class JdbcTemplate extends JdbcAccessor implements JdbcOperations {
* If this is {@code null}, the SQL will be assumed to contain no bind parameters.
* @param rowMapper a callback that will map one object per row
* @return the result Stream, containing mapped objects, needing to be
* closed once fully processed (e.g. through a try-with-resources clause)
* closed once fully processed (for example, through a try-with-resources clause)
* @throws DataAccessException if the query fails
* @since 5.3
*/

View File

@@ -22,7 +22,7 @@ package org.springframework.jdbc.core;
*
* <p>Typically implemented by {@code PreparedStatementCreators} and
* {@code PreparedStatementSetters} that support {@link DisposableSqlTypeValue}
* objects (e.g. {@code SqlLobValue}) as parameters.
* objects (for example, {@code SqlLobValue}) as parameters.
*
* @author Thomas Risberg
* @author Juergen Hoeller

View File

@@ -75,7 +75,7 @@ public abstract class StatementCreatorUtils {
* {@link PreparedStatement#setNull} / {@link PreparedStatement#setObject} calls based on
* well-known behavior of common databases.
* <p>Consider switching this flag to "true" if you experience misbehavior at runtime,
* e.g. with connection pool issues in case of an exception thrown from {@code getParameterType}
* for example, with connection pool issues in case of an exception thrown from {@code getParameterType}
* (as reported on JBoss AS 7) or in case of performance problems (as reported on PostgreSQL).
*/
public static final String IGNORE_GETPARAMETERTYPE_PROPERTY_NAME = "spring.jdbc.getParameterType.ignore";
@@ -324,7 +324,7 @@ public abstract class StatementCreatorUtils {
throw ex;
}
// Fall back to generic setNull call without SQL type specified
// (e.g. for MySQL TIME_WITH_TIMEZONE / TIMESTAMP_WITH_TIMEZONE).
// (for example, for MySQL TIME_WITH_TIMEZONE / TIMESTAMP_WITH_TIMEZONE).
ps.setNull(paramIndex, Types.NULL);
}
}
@@ -461,7 +461,7 @@ public abstract class StatementCreatorUtils {
}
catch (SQLFeatureNotSupportedException ex) {
// Fall back to generic setObject call without SQL type specified
// (e.g. for MySQL TIME_WITH_TIMEZONE / TIMESTAMP_WITH_TIMEZONE).
// (for example, for MySQL TIME_WITH_TIMEZONE / TIMESTAMP_WITH_TIMEZONE).
ps.setObject(paramIndex, inValue);
}
}

View File

@@ -241,7 +241,7 @@ public interface NamedParameterJdbcOperations {
* @param paramSource container of arguments to bind to the query
* @param rowMapper object that will map one object per row
* @return the result Stream, containing mapped objects, needing to be
* closed once fully processed (e.g. through a try-with-resources clause)
* closed once fully processed (for example, through a try-with-resources clause)
* @throws DataAccessException if the query fails
* @since 5.3
*/
@@ -257,7 +257,7 @@ public interface NamedParameterJdbcOperations {
* (leaving it to the PreparedStatement to guess the corresponding SQL type)
* @param rowMapper object that will map one object per row
* @return the result Stream, containing mapped objects, needing to be
* closed once fully processed (e.g. through a try-with-resources clause)
* closed once fully processed (for example, through a try-with-resources clause)
* @throws DataAccessException if the query fails
* @since 5.3
*/

View File

@@ -206,7 +206,7 @@ public interface JdbcClient {
* <p>The given parameter object will define all named parameters
* based on its JavaBean properties, record components, or raw fields.
* A Map instance can be provided as a complete parameter source as well.
* @param namedParamObject a custom parameter object (e.g. a JavaBean,
* @param namedParamObject a custom parameter object (for example, a JavaBean,
* record class, or field holder) with named properties serving as
* statement parameters
* @return this statement specification (for chaining)
@@ -377,7 +377,7 @@ public interface JdbcClient {
* Retrieve the result as a lazily resolved stream of mapped objects,
* retaining the order from the original database result.
* @return the result Stream, containing mapped objects, needing to be
* closed once fully processed (e.g. through a try-with-resources clause)
* closed once fully processed (for example, through a try-with-resources clause)
*/
Stream<T> stream();

View File

@@ -99,7 +99,7 @@ public class JdbcBeanDefinitionReader {
* Load bean definitions from the database via the given SQL string.
* @param sql the SQL query to use for loading bean definitions.
* The first three columns must be bean name, property name and value.
* Any join and any other columns are permitted: e.g.
* Any join and any other columns are permitted: for example,
* {@code SELECT BEAN_NAME, PROPERTY, VALUE FROM CONFIG WHERE CONFIG.APP_ID = 1}
* It's also possible to perform a join. Column names are not significant --
* only the ordering of these first three columns.

View File

@@ -29,14 +29,14 @@ import org.springframework.jdbc.core.SqlTypeValue;
import org.springframework.lang.Nullable;
/**
* Object to represent a binary parameter value for a SQL statement, e.g.
* Object to represent a binary parameter value for a SQL statement, for example,
* a binary stream for a BLOB or a LONGVARBINARY or PostgreSQL BYTEA column.
*
* <p>Designed for use with {@link org.springframework.jdbc.core.JdbcTemplate}
* as well as {@link org.springframework.jdbc.core.simple.JdbcClient}, to be
* passed in as a parameter value wrapping the target content value. Can be
* combined with {@link org.springframework.jdbc.core.SqlParameterValue} for
* specifying a SQL type, e.g.
* specifying a SQL type, for example,
* {@code new SqlParameterValue(Types.BLOB, new SqlBinaryValue(myContent))}.
* With most database drivers, the type hint is not actually necessary.
*

View File

@@ -29,13 +29,13 @@ import org.springframework.lang.Nullable;
/**
* Object to represent a character-based parameter value for a SQL statement,
* e.g. a character stream for a CLOB/NCLOB or a LONGVARCHAR column.
* for example, a character stream for a CLOB/NCLOB or a LONGVARCHAR column.
*
* <p>Designed for use with {@link org.springframework.jdbc.core.JdbcTemplate}
* as well as {@link org.springframework.jdbc.core.simple.JdbcClient}, to be
* passed in as a parameter value wrapping the target content value. Can be
* combined with {@link org.springframework.jdbc.core.SqlParameterValue} for
* specifying a SQL type, e.g.
* specifying a SQL type, for example,
* {@code new SqlParameterValue(Types.CLOB, new SqlCharacterValue(myContent))}.
* With most database drivers, the type hint is not actually necessary.
*

View File

@@ -91,7 +91,7 @@ import org.springframework.util.Assert;
* <p>This transaction manager can be used as a replacement for the
* {@link org.springframework.transaction.jta.JtaTransactionManager} in the single
* resource case, as it does not require a container that supports JTA, typically
* in combination with a locally defined JDBC {@code DataSource} (e.g. a Hikari
* in combination with a locally defined JDBC {@code DataSource} (for example, a Hikari
* connection pool). Switching between this local strategy and a JTA environment
* is just a matter of configuration!
*
@@ -99,7 +99,7 @@ import org.springframework.util.Assert;
* transaction synchronizations (if synchronization is generally active), assuming
* resources operating on the underlying JDBC {@code Connection}. This allows for
* setup analogous to {@code JtaTransactionManager}, in particular with respect to
* lazily registered ORM resources (e.g. a Hibernate {@code Session}).
* lazily registered ORM resources (for example, a Hibernate {@code Session}).
*
* <p><b>NOTE: As of 5.3, {@link org.springframework.jdbc.support.JdbcTransactionManager}
* is available as an extended subclass which includes commit/rollback exception
@@ -211,7 +211,7 @@ public class DataSourceTransactionManager extends AbstractPlatformTransactionMan
* this read-only mode provides read consistency for the entire transaction.
* <p>Note that older Oracle JDBC drivers (9i, 10g) used to enforce this read-only
* mode even for {@code Connection.setReadOnly(true}. However, with recent drivers,
* this strong enforcement needs to be applied explicitly, e.g. through this flag.
* this strong enforcement needs to be applied explicitly, for example, through this flag.
* @since 4.3.7
* @see #prepareTransactionalConnection
*/

View File

@@ -35,7 +35,7 @@ import org.springframework.util.Assert;
/**
* Helper class that provides static methods for obtaining JDBC {@code Connection}s
* from a {@link javax.sql.DataSource}. Includes special support for Spring-managed
* transactional {@code Connection}s, e.g. managed by {@link DataSourceTransactionManager}
* transactional {@code Connection}s, for example, managed by {@link DataSourceTransactionManager}
* or {@link org.springframework.transaction.jta.JtaTransactionManager}.
*
* <p>Used internally by Spring's {@link org.springframework.jdbc.core.JdbcTemplate},
@@ -67,7 +67,7 @@ public abstract class DataSourceUtils {
* calling code and making any exception that is thrown more meaningful.
* <p>Is aware of a corresponding Connection bound to the current thread, for example
* when using {@link DataSourceTransactionManager}. Will bind a Connection to the
* thread if transaction synchronization is active, e.g. when running within a
* thread if transaction synchronization is active, for example, when running within a
* {@link org.springframework.transaction.jta.JtaTransactionManager JTA} transaction).
* @param dataSource the DataSource to obtain Connections from
* @return a JDBC Connection from the given DataSource
@@ -93,7 +93,7 @@ public abstract class DataSourceUtils {
* Same as {@link #getConnection}, but throwing the original SQLException.
* <p>Is aware of a corresponding Connection bound to the current thread, for example
* when using {@link DataSourceTransactionManager}. Will bind a Connection to the thread
* if transaction synchronization is active (e.g. if in a JTA transaction).
* if transaction synchronization is active (for example, if in a JTA transaction).
* <p>Directly accessed by {@link TransactionAwareDataSourceProxy}.
* @param dataSource the DataSource to obtain Connections from
* @return a JDBC Connection from the given DataSource
@@ -193,7 +193,7 @@ public abstract class DataSourceUtils {
Throwable exToCheck = ex;
while (exToCheck != null) {
if (exToCheck.getClass().getSimpleName().contains("Timeout")) {
// Assume it's a connection timeout that would otherwise get lost: e.g. from JDBC 4.0
// Assume it's a connection timeout that would otherwise get lost: for example, from JDBC 4.0
throw ex;
}
exToCheck = exToCheck.getCause();
@@ -465,7 +465,7 @@ public abstract class DataSourceUtils {
/**
* Callback for resource cleanup at the end of a non-native JDBC transaction
* (e.g. when participating in a JtaTransactionManager transaction).
* (for example, when participating in a JtaTransactionManager transaction).
* @see org.springframework.transaction.jta.JtaTransactionManager
*/
private static class ConnectionSynchronization implements TransactionSynchronization {

View File

@@ -37,7 +37,7 @@ import org.springframework.util.Assert;
*
* <p>Inherits the capability to apply specific user credentials from its superclass
* {@link UserCredentialsDataSourceAdapter}; see the latter's javadoc for details
* on that functionality (e.g. {@link #setCredentialsForCurrentThread}).
* on that functionality (for example, {@link #setCredentialsForCurrentThread}).
*
* <p><b>WARNING:</b> This adapter simply calls
* {@link java.sql.Connection#setTransactionIsolation} and/or

View File

@@ -48,7 +48,7 @@ import org.springframework.util.Assert;
* without fetching a Connection from the pool or communicating with the
* database; this will be done lazily on first creation of a JDBC Statement.
* As a bonus, this allows for taking the transaction-synchronized read-only
* flag and/or isolation level into account in a routing DataSource (e.g.
* flag and/or isolation level into account in a routing DataSource (for example,
* {@link org.springframework.jdbc.datasource.lookup.IsolationLevelDataSourceRouter}).
*
* <p><b>If you configure both a LazyConnectionDataSourceProxy and a
@@ -184,7 +184,7 @@ public class LazyConnectionDataSourceProxy extends DelegatingDataSource {
/**
* Set the default transaction isolation level to expose when no target Connection
* has been fetched yet (when the actual JDBC Connection default is not known yet).
* <p>This property accepts the int constant value (e.g. 8) as defined in the
* <p>This property accepts the int constant value (for example, 8) as defined in the
* {@link java.sql.Connection} interface; it is mainly intended for programmatic
* use. Consider using the "defaultTransactionIsolationName" property for setting
* the value by name (for example, {@code "TRANSACTION_SERIALIZABLE"}).

View File

@@ -27,7 +27,7 @@ import org.springframework.lang.Nullable;
* for providing the current sharding key (plus optionally a super sharding key) in
* {@link org.springframework.jdbc.datasource.ShardingKeyDataSourceAdapter}.
*
* <p>Can be used as a functional interface (e.g. with a lambda expression) for a simple
* <p>Can be used as a functional interface (for example, with a lambda expression) for a simple
* sharding key, or as a two-method interface when including a super sharding key as well.
*
* @author Mohamed Lahyane (Anir)

View File

@@ -36,7 +36,7 @@ import org.springframework.util.ObjectUtils;
*
* <p>Note that at shutdown, someone should close the underlying Connection
* via the {@code close()} method. Client code will never call close
* on the Connection handle if it is SmartDataSource-aware (e.g. uses
* on the Connection handle if it is SmartDataSource-aware (for example, uses
* {@code DataSourceUtils.releaseConnection}).
*
* <p>If client code will call {@code close()} in the assumption of a pooled

View File

@@ -237,7 +237,7 @@ public class TransactionAwareDataSourceProxy extends DelegatingDataSource {
if (this.target == null) {
if (method.getName().equals("getWarnings") || method.getName().equals("clearWarnings")) {
// Avoid creation of target Connection on pre-close cleanup (e.g. Hibernate Session)
// Avoid creation of target Connection on pre-close cleanup (for example, Hibernate Session)
return null;
}
if (this.closed) {

View File

@@ -33,8 +33,8 @@ import org.springframework.util.Assert;
* <p>This is particularly useful in combination with JTA transaction management
* (typically through Spring's {@link org.springframework.transaction.jta.JtaTransactionManager}).
* Standard JTA does not support transaction-specific isolation levels. Some JTA
* providers support isolation levels as a vendor-specific extension (e.g. WebLogic),
* which is the preferred way of addressing this. As an alternative (e.g. on WebSphere),
* providers support isolation levels as a vendor-specific extension (for example, WebLogic),
* which is the preferred way of addressing this. As an alternative (for example, on WebSphere),
* the target database can be represented through multiple JNDI DataSources, each
* configured with a different isolation level (for the entire DataSource).
* {@code IsolationLevelDataSourceRouter} allows to transparently switch to the

View File

@@ -31,7 +31,7 @@ import org.springframework.lang.Nullable;
* which applies the same {@link SQLExceptionTranslator} infrastructure by default.
*
* <p>Exception translation is specifically relevant for commit steps in serializable
* transactions (e.g. on Postgres) where concurrency failures may occur late on commit.
* transactions (for example, on Postgres) where concurrency failures may occur late on commit.
* This allows for throwing {@link org.springframework.dao.ConcurrencyFailureException} to
* callers instead of {@link org.springframework.transaction.TransactionSystemException}.
*

View File

@@ -141,7 +141,7 @@ public abstract class JdbcUtils {
* {@link #getResultSetValue(java.sql.ResultSet, int)} for unknown types.
* <p>Note that the returned value may not be assignable to the specified
* required type, in case of an unknown type. Calling code needs to deal
* with this case appropriately, e.g. throwing a corresponding exception.
* with this case appropriately, for example, throwing a corresponding exception.
* @param rs is the ResultSet holding the data
* @param index is the column index
* @param requiredType the required value type (may be {@code null})
@@ -207,7 +207,7 @@ public abstract class JdbcUtils {
}
else if (requiredType.isEnum()) {
// Enums can either be represented through a String or an enum index value:
// leave enum type conversion up to the caller (e.g. a ConversionService)
// leave enum type conversion up to the caller (for example, a ConversionService)
// but make sure that we return nothing other than a String or an Integer.
Object obj = rs.getObject(index);
if (obj instanceof String) {
@@ -219,7 +219,7 @@ public abstract class JdbcUtils {
return NumberUtils.convertNumberToTargetClass(number, Integer.class);
}
else {
// e.g. on Postgres: getObject returns a PGObject, but we need a String
// for example, on Postgres: getObject returns a PGObject, but we need a String
return rs.getString(index);
}
}
@@ -240,7 +240,7 @@ public abstract class JdbcUtils {
}
// Corresponding SQL types for JSR-310 / Joda-Time types, left up
// to the caller to convert them (e.g. through a ConversionService).
// to the caller to convert them (for example, through a ConversionService).
String typeName = requiredType.getSimpleName();
return switch (typeName) {
case "LocalDate" -> rs.getDate(index);
@@ -443,7 +443,7 @@ public abstract class JdbcUtils {
* Extract a common name for the target database in use even if
* various drivers/platforms provide varying names at runtime.
* @param source the name as provided in database meta-data
* @return the common name to be used (e.g. "DB2" or "Sybase")
* @return the common name to be used (for example, "DB2" or "Sybase")
*/
@Nullable
public static String commonDatabaseName(@Nullable String source) {
@@ -476,7 +476,7 @@ public abstract class JdbcUtils {
* Resolve the standard type name for the given SQL type, if possible.
* @param sqlType the SQL type to resolve
* @return the corresponding constant name in {@link java.sql.Types}
* (e.g. "VARCHAR"/"NUMERIC"), or {@code null} if not resolvable
* (for example, "VARCHAR"/"NUMERIC"), or {@code null} if not resolvable
* @since 5.2
*/
@Nullable

View File

@@ -57,7 +57,7 @@ import org.springframework.util.function.SupplierUtils;
*
* <p>The configuration file named "sql-error-codes.xml" is by default read from
* this package. It can be overridden through a file of the same name in the root
* of the class path (e.g. in the "/WEB-INF/classes" directory), as long as the
* of the class path (for example, in the "/WEB-INF/classes" directory), as long as the
* Spring JDBC package is loaded from the same ClassLoader.
*
* <p>This translator is commonly used by default if a user-provided `sql-error-codes.xml`
@@ -217,7 +217,7 @@ public class SQLErrorCodeSQLExceptionTranslator extends AbstractFallbackSQLExcep
}
else {
// Try to find SQLException with actual error code, looping through the causes.
// E.g. applicable to java.sql.DataTruncation as of JDK 1.6.
// For example, applicable to java.sql.DataTruncation as of JDK 1.6.
SQLException current = sqlEx;
while (current.getErrorCode() == 0 && current.getCause() instanceof SQLException sqlException) {
current = sqlException;

View File

@@ -54,7 +54,7 @@ public class SQLErrorCodesFactory {
/**
* The name of custom SQL error codes file, loading from the root
* of the class path (e.g. from the "/WEB-INF/classes" directory).
* of the class path (for example, from the "/WEB-INF/classes" directory).
*/
public static final String SQL_ERROR_CODE_OVERRIDE_PATH = "sql-error-codes.xml";

View File

@@ -72,8 +72,8 @@ public class SQLStateSQLExceptionTranslator extends AbstractFallbackSQLException
private static final Set<String> DATA_ACCESS_RESOURCE_FAILURE_CODES = Set.of(
"08", // Connection exception
"53", // PostgreSQL: insufficient resources (e.g. disk full)
"54", // PostgreSQL: program limit exceeded (e.g. statement too complex)
"53", // PostgreSQL: insufficient resources (for example, disk full)
"54", // PostgreSQL: program limit exceeded (for example, statement too complex)
"57", // DB2: out-of-memory exception / database not started
"58" // DB2: unexpected system error
);

View File

@@ -102,7 +102,7 @@ public class DefaultLobHandler extends AbstractLobHandler {
* <p>Default is "false", using the common JDBC 2.0 {@code setBinaryStream}
* / {@code setCharacterStream} method for setting the content. Switch this
* to "true" for explicit Blob / Clob wrapping against JDBC drivers that
* are known to require such wrapping (e.g. PostgreSQL's for access to OID
* are known to require such wrapping (for example, PostgreSQL's for access to OID
* columns, whereas BYTEA columns need to be accessed the standard way).
* <p>This setting affects byte array / String arguments as well as stream
* arguments, unless {@link #setStreamAsLob "streamAsLob"} overrides this
@@ -121,7 +121,7 @@ public class DefaultLobHandler extends AbstractLobHandler {
* <p>Default is "false", using the common JDBC 2.0 {@code setBinaryStream}
* / {@code setCharacterStream} method for setting the content.
* Switch this to "true" for explicit JDBC 4.0 streaming, provided that your
* JDBC driver actually supports those JDBC 4.0 operations (e.g. Derby's).
* JDBC driver actually supports those JDBC 4.0 operations (for example, Derby's).
* <p>This setting affects stream arguments as well as byte array / String
* arguments, requiring JDBC 4.0 support. For supporting LOB content against
* JDBC 3.0, check out the {@link #setWrapAsLob "wrapAsLob"} setting.

View File

@@ -37,7 +37,7 @@ import org.springframework.lang.Nullable;
* which by default delegates to JDBC's direct accessor methods, avoiding the
* {@code java.sql.Blob} and {@code java.sql.Clob} API completely.
* {@link DefaultLobHandler} can also be configured to access LOBs using
* {@code PreparedStatement.setBlob/setClob} (e.g. for PostgreSQL), through
* {@code PreparedStatement.setBlob/setClob} (for example, for PostgreSQL), through
* setting the {@link DefaultLobHandler#setWrapAsLob "wrapAsLob"} property.
*
* <p>Of course, you need to declare different field types for each database.

View File

@@ -159,7 +159,7 @@
<xsd:annotation>
<xsd:documentation><![CDATA[
The resource location of an SQL script to execute. Can be a single script location
or a pattern (e.g. classpath:/com/foo/sql/*-data.sql).
or a pattern (for example, classpath:/com/foo/sql/*-data.sql).
]]></xsd:documentation>
</xsd:annotation>
</xsd:attribute>