From 25525ff98db0c2261e745b3012156ef91afffe58 Mon Sep 17 00:00:00 2001 From: Mahmoud Ben Hassine Date: Thu, 22 May 2025 10:01:07 +0200 Subject: [PATCH] Fix code style/formatting --- .../support/JdbcJobRepositoryFactoryBean.java | 207 +++++++++--------- .../support/JobRepositoryFactoryBean.java | 27 +-- 2 files changed, 111 insertions(+), 123 deletions(-) diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/support/JdbcJobRepositoryFactoryBean.java b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/support/JdbcJobRepositoryFactoryBean.java index 1a60b42aa..5250f2392 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/support/JdbcJobRepositoryFactoryBean.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/support/JdbcJobRepositoryFactoryBean.java @@ -46,105 +46,105 @@ import java.nio.charset.Charset; */ public class JdbcJobRepositoryFactoryBean extends JobRepositoryFactoryBean { - /** - * @param type a value from the {@link java.sql.Types} class to indicate the type to - * use for a CLOB - */ - public void setClobType(int type) { - super.setClobType(type); - } + /** + * @param type a value from the {@link java.sql.Types} class to indicate the type to + * use for a CLOB + */ + public void setClobType(int type) { + super.setClobType(type); + } - /** - * A custom implementation of the {@link ExecutionContextSerializer}. The default, if - * not injected, is the {@link DefaultExecutionContextSerializer}. - * @param serializer used to serialize/deserialize - * {@link org.springframework.batch.item.ExecutionContext} - * @see ExecutionContextSerializer - */ - public void setSerializer(ExecutionContextSerializer serializer) { - super.setSerializer(serializer); - } + /** + * A custom implementation of the {@link ExecutionContextSerializer}. The default, if + * not injected, is the {@link DefaultExecutionContextSerializer}. + * @param serializer used to serialize/deserialize + * {@link org.springframework.batch.item.ExecutionContext} + * @see ExecutionContextSerializer + */ + public void setSerializer(ExecutionContextSerializer serializer) { + super.setSerializer(serializer); + } - /** - * Public setter for the length of long string columns in database. Do not set this if - * you haven't modified the schema. Note this value will be used for the exit message - * in both {@link JdbcJobExecutionDao} and {@link JdbcStepExecutionDao} and also the - * short version of the execution context in {@link JdbcExecutionContextDao} . If you - * want to use separate values for exit message and short context, then use - * {@link #setMaxVarCharLengthForExitMessage(int)} and - * {@link #setMaxVarCharLengthForShortContext(int)}. For databases with multi-byte - * character sets this number can be smaller (by up to a factor of 2 for 2-byte - * characters) than the declaration of the column length in the DDL for the tables. - * @param maxVarCharLength the exitMessageLength to set - */ - public void setMaxVarCharLength(int maxVarCharLength) { - super.setMaxVarCharLength(maxVarCharLength); - } + /** + * Public setter for the length of long string columns in database. Do not set this if + * you haven't modified the schema. Note this value will be used for the exit message + * in both {@link JdbcJobExecutionDao} and {@link JdbcStepExecutionDao} and also the + * short version of the execution context in {@link JdbcExecutionContextDao} . If you + * want to use separate values for exit message and short context, then use + * {@link #setMaxVarCharLengthForExitMessage(int)} and + * {@link #setMaxVarCharLengthForShortContext(int)}. For databases with multi-byte + * character sets this number can be smaller (by up to a factor of 2 for 2-byte + * characters) than the declaration of the column length in the DDL for the tables. + * @param maxVarCharLength the exitMessageLength to set + */ + public void setMaxVarCharLength(int maxVarCharLength) { + super.setMaxVarCharLength(maxVarCharLength); + } - /** - * Public setter for the length of short context string column in database. Do not set - * this if you haven't modified the schema. For databases with multi-byte character - * sets this number can be smaller (by up to a factor of 2 for 2-byte characters) than - * the declaration of the column length in the DDL for the tables. Defaults to - * {@link AbstractJdbcBatchMetadataDao#DEFAULT_SHORT_CONTEXT_LENGTH} - * @param maxVarCharLengthForShortContext the short context length to set - * @since 5.1 - */ - public void setMaxVarCharLengthForShortContext(int maxVarCharLengthForShortContext) { - super.setMaxVarCharLengthForShortContext(maxVarCharLengthForShortContext); - } + /** + * Public setter for the length of short context string column in database. Do not set + * this if you haven't modified the schema. For databases with multi-byte character + * sets this number can be smaller (by up to a factor of 2 for 2-byte characters) than + * the declaration of the column length in the DDL for the tables. Defaults to + * {@link AbstractJdbcBatchMetadataDao#DEFAULT_SHORT_CONTEXT_LENGTH} + * @param maxVarCharLengthForShortContext the short context length to set + * @since 5.1 + */ + public void setMaxVarCharLengthForShortContext(int maxVarCharLengthForShortContext) { + super.setMaxVarCharLengthForShortContext(maxVarCharLengthForShortContext); + } - /** - * Public setter for the length of the exit message in both - * {@link JdbcJobExecutionDao} and {@link JdbcStepExecutionDao}. Do not set this if - * you haven't modified the schema. For databases with multi-byte character sets this - * number can be smaller (by up to a factor of 2 for 2-byte characters) than the - * declaration of the column length in the DDL for the tables. Defaults to - * {@link AbstractJdbcBatchMetadataDao#DEFAULT_EXIT_MESSAGE_LENGTH}. - * @param maxVarCharLengthForExitMessage the exitMessageLength to set - * @since 5.1 - */ - public void setMaxVarCharLengthForExitMessage(int maxVarCharLengthForExitMessage) { - super.setMaxVarCharLengthForExitMessage(maxVarCharLengthForExitMessage); - } + /** + * Public setter for the length of the exit message in both + * {@link JdbcJobExecutionDao} and {@link JdbcStepExecutionDao}. Do not set this if + * you haven't modified the schema. For databases with multi-byte character sets this + * number can be smaller (by up to a factor of 2 for 2-byte characters) than the + * declaration of the column length in the DDL for the tables. Defaults to + * {@link AbstractJdbcBatchMetadataDao#DEFAULT_EXIT_MESSAGE_LENGTH}. + * @param maxVarCharLengthForExitMessage the exitMessageLength to set + * @since 5.1 + */ + public void setMaxVarCharLengthForExitMessage(int maxVarCharLengthForExitMessage) { + super.setMaxVarCharLengthForExitMessage(maxVarCharLengthForExitMessage); + } - /** - * Public setter for the {@link DataSource}. - * @param dataSource a {@link DataSource} - */ - public void setDataSource(DataSource dataSource) { - super.setDataSource(dataSource); - } + /** + * Public setter for the {@link DataSource}. + * @param dataSource a {@link DataSource} + */ + public void setDataSource(DataSource dataSource) { + super.setDataSource(dataSource); + } - /** - * Public setter for the {@link JdbcOperations}. If this property is not set - * explicitly, a new {@link JdbcTemplate} will be created for the configured - * DataSource by default. - * @param jdbcOperations a {@link JdbcOperations} - */ - public void setJdbcOperations(JdbcOperations jdbcOperations) { - super.setJdbcOperations(jdbcOperations); - } + /** + * Public setter for the {@link JdbcOperations}. If this property is not set + * explicitly, a new {@link JdbcTemplate} will be created for the configured + * DataSource by default. + * @param jdbcOperations a {@link JdbcOperations} + */ + public void setJdbcOperations(JdbcOperations jdbcOperations) { + super.setJdbcOperations(jdbcOperations); + } - /** - * Sets the database type. - * @param dbType as specified by {@link DefaultDataFieldMaxValueIncrementerFactory} - */ - public void setDatabaseType(String dbType) { - super.setDatabaseType(dbType); - } + /** + * Sets the database type. + * @param dbType as specified by {@link DefaultDataFieldMaxValueIncrementerFactory} + */ + public void setDatabaseType(String dbType) { + super.setDatabaseType(dbType); + } - /** - * Sets the table prefix for all the batch meta-data tables. - * @param tablePrefix prefix prepended to batch meta-data tables - */ - public void setTablePrefix(String tablePrefix) { - super.setTablePrefix(tablePrefix); - } + /** + * Sets the table prefix for all the batch meta-data tables. + * @param tablePrefix prefix prepended to batch meta-data tables + */ + public void setTablePrefix(String tablePrefix) { + super.setTablePrefix(tablePrefix); + } - public void setIncrementerFactory(DataFieldMaxValueIncrementerFactory incrementerFactory) { - super.setIncrementerFactory(incrementerFactory); - } + public void setIncrementerFactory(DataFieldMaxValueIncrementerFactory incrementerFactory) { + super.setIncrementerFactory(incrementerFactory); + } /** * Set the {@link Charset} to use when serializing/deserializing the execution @@ -157,18 +157,19 @@ public class JdbcJobRepositoryFactoryBean extends JobRepositoryFactoryBean { super.setCharset(charset); } - /** - * Set the conversion service to use in the job repository. This service is used to - * convert job parameters from String literal to typed values and vice versa. - * @param conversionService the conversion service to use - * @since 5.0 - */ - public void setConversionService(@NonNull ConfigurableConversionService conversionService) { - super.setConversionService(conversionService); - } + /** + * Set the conversion service to use in the job repository. This service is used to + * convert job parameters from String literal to typed values and vice versa. + * @param conversionService the conversion service to use + * @since 5.0 + */ + public void setConversionService(@NonNull ConfigurableConversionService conversionService) { + super.setConversionService(conversionService); + } + + @Override + public void afterPropertiesSet() throws Exception { + super.afterPropertiesSet(); + } - @Override - public void afterPropertiesSet() throws Exception { - super.afterPropertiesSet(); - } } diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/support/JobRepositoryFactoryBean.java b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/support/JobRepositoryFactoryBean.java index a3f4ecc9e..92781dfd6 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/support/JobRepositoryFactoryBean.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/support/JobRepositoryFactoryBean.java @@ -16,18 +16,8 @@ package org.springframework.batch.core.repository.support; -import java.lang.reflect.Field; -import java.nio.charset.Charset; -import java.nio.charset.StandardCharsets; -import java.sql.Types; - -import javax.sql.DataSource; - import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; - -import org.springframework.batch.core.DefaultJobKeyGenerator; -import org.springframework.batch.core.JobKeyGenerator; import org.springframework.batch.core.converter.DateToStringConverter; import org.springframework.batch.core.converter.LocalDateTimeToStringConverter; import org.springframework.batch.core.converter.LocalDateToStringConverter; @@ -37,16 +27,7 @@ import org.springframework.batch.core.converter.StringToLocalDateConverter; import org.springframework.batch.core.converter.StringToLocalDateTimeConverter; import org.springframework.batch.core.converter.StringToLocalTimeConverter; import org.springframework.batch.core.repository.ExecutionContextSerializer; -import org.springframework.batch.core.repository.dao.AbstractJdbcBatchMetadataDao; -import org.springframework.batch.core.repository.dao.DefaultExecutionContextSerializer; -import org.springframework.batch.core.repository.dao.ExecutionContextDao; -import org.springframework.batch.core.repository.dao.JdbcExecutionContextDao; -import org.springframework.batch.core.repository.dao.JdbcJobExecutionDao; -import org.springframework.batch.core.repository.dao.JdbcJobInstanceDao; -import org.springframework.batch.core.repository.dao.JdbcStepExecutionDao; -import org.springframework.batch.core.repository.dao.JobExecutionDao; -import org.springframework.batch.core.repository.dao.JobInstanceDao; -import org.springframework.batch.core.repository.dao.StepExecutionDao; +import org.springframework.batch.core.repository.dao.*; import org.springframework.batch.item.database.support.DataFieldMaxValueIncrementerFactory; import org.springframework.batch.item.database.support.DefaultDataFieldMaxValueIncrementerFactory; import org.springframework.batch.support.DatabaseType; @@ -60,6 +41,12 @@ import org.springframework.lang.NonNull; import org.springframework.util.Assert; import org.springframework.util.StringUtils; +import javax.sql.DataSource; +import java.lang.reflect.Field; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.sql.Types; + import static org.springframework.batch.support.DatabaseType.SYBASE; /**