Mark fields as final where appropriate

This commit is contained in:
Mahmoud Ben Hassine
2023-07-04 21:45:20 +02:00
parent 241e37e672
commit 0a1cdb095f
166 changed files with 411 additions and 365 deletions

View File

@@ -36,11 +36,11 @@ import org.springframework.util.Assert;
*/
public class JobParameter<T> implements Serializable {
private T value;
private final T value;
private Class<T> type;
private final Class<T> type;
private boolean identifying;
private final boolean identifying;
/**
* Create a new {@link JobParameter}.

View File

@@ -44,7 +44,7 @@ public class StepContribution implements Serializable {
private ExitStatus exitStatus = ExitStatus.EXECUTING;
private volatile StepExecution stepExecution;
private final StepExecution stepExecution;
/**
* @param execution {@link StepExecution} the stepExecution used to initialize

View File

@@ -52,7 +52,7 @@ public abstract class AbstractApplicationContextFactory implements ApplicationCo
private static final Log logger = LogFactory.getLog(AbstractApplicationContextFactory.class);
private Object[] resources;
private final Object[] resources;
private ConfigurableApplicationContext parent;

View File

@@ -45,7 +45,7 @@ import org.springframework.util.Assert;
*/
public class AutomaticJobRegistrar implements Ordered, SmartLifecycle, ApplicationContextAware, InitializingBean {
private Collection<ApplicationContextFactory> applicationContextFactories = new ArrayList<>();
private final Collection<ApplicationContextFactory> applicationContextFactories = new ArrayList<>();
private JobLoader jobLoader;
@@ -57,7 +57,7 @@ public class AutomaticJobRegistrar implements Ordered, SmartLifecycle, Applicati
private boolean autoStartup = true;
private Object lifecycleMonitor = new Object();
private final Object lifecycleMonitor = new Object();
private int order = Ordered.LOWEST_PRECEDENCE;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2022 the original author or authors.
* Copyright 2006-2023 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.
@@ -50,15 +50,15 @@ import org.springframework.util.Assert;
*/
public class DefaultJobLoader implements JobLoader, InitializingBean {
private static Log logger = LogFactory.getLog(DefaultJobLoader.class);
private static final Log logger = LogFactory.getLog(DefaultJobLoader.class);
private JobRegistry jobRegistry;
private StepRegistry stepRegistry;
private Map<ApplicationContextFactory, ConfigurableApplicationContext> contexts = new ConcurrentHashMap<>();
private final Map<ApplicationContextFactory, ConfigurableApplicationContext> contexts = new ConcurrentHashMap<>();
private Map<ConfigurableApplicationContext, Collection<String>> contextToJobNames = new ConcurrentHashMap<>();
private final Map<ConfigurableApplicationContext, Collection<String>> contextToJobNames = new ConcurrentHashMap<>();
/**
* Default constructor. Useful for declarative configuration.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2022 the original author or authors.
* Copyright 2006-2023 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,7 +31,7 @@ import org.springframework.batch.core.configuration.JobRegistry;
*/
public class JobFactoryRegistrationListener {
private Log logger = LogFactory.getLog(getClass());
private final Log logger = LogFactory.getLog(getClass());
private JobRegistry jobRegistry;

View File

@@ -48,12 +48,12 @@ import org.springframework.util.Assert;
public class JobRegistryBeanPostProcessor
implements BeanPostProcessor, BeanFactoryAware, InitializingBean, DisposableBean {
private static Log logger = LogFactory.getLog(JobRegistryBeanPostProcessor.class);
private static final Log logger = LogFactory.getLog(JobRegistryBeanPostProcessor.class);
// It doesn't make sense for this to have a default value...
private JobRegistry jobRegistry = null;
private Collection<String> jobNames = new HashSet<>();
private final Collection<String> jobNames = new HashSet<>();
private String groupName = null;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2022 the original author or authors.
* Copyright 2006-2023 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.
@@ -27,7 +27,7 @@ import org.springframework.batch.core.configuration.JobFactory;
*/
public class ReferenceJobFactory implements JobFactory {
private Job job;
private final Job job;
/**
* @param job the {@link Job} to return from {@link #createJob()}.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2021-2022 the original author or authors.
* Copyright 2021-2023 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.
@@ -29,9 +29,9 @@ import org.springframework.context.annotation.Configuration;
@Configuration(proxyBeanMethods = false)
public class ScopeConfiguration {
private static StepScope stepScope;
private static final StepScope stepScope;
private static JobScope jobScope;
private static final JobScope jobScope;
static {
jobScope = new JobScope();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2022 the original author or authors.
* Copyright 2006-2023 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.
@@ -37,7 +37,7 @@ import org.springframework.util.StringUtils;
*/
public class JobParserJobFactoryBean implements SmartFactoryBean<FlowJob> {
private String name;
private final String name;
private Boolean restartable;

View File

@@ -114,7 +114,7 @@ public class StepParserStepFactoryBean<I, O> implements FactoryBean<Step>, BeanN
private PlatformTransactionManager transactionManager;
private Set<Object> stepExecutionListeners = new LinkedHashSet<>();
private final Set<Object> stepExecutionListeners = new LinkedHashSet<>();
//
// Flow Elements
@@ -154,7 +154,7 @@ public class StepParserStepFactoryBean<I, O> implements FactoryBean<Step>, BeanN
private Isolation isolation;
private Set<ChunkListener> chunkListeners = new LinkedHashSet<>();
private final Set<ChunkListener> chunkListeners = new LinkedHashSet<>();
//
// Chunk Attributes
@@ -204,13 +204,13 @@ public class StepParserStepFactoryBean<I, O> implements FactoryBean<Step>, BeanN
private ItemStream[] streams;
private Set<ItemReadListener<I>> readListeners = new LinkedHashSet<>();
private final Set<ItemReadListener<I>> readListeners = new LinkedHashSet<>();
private Set<ItemWriteListener<O>> writeListeners = new LinkedHashSet<>();
private final Set<ItemWriteListener<O>> writeListeners = new LinkedHashSet<>();
private Set<ItemProcessListener<I, O>> processListeners = new LinkedHashSet<>();
private final Set<ItemProcessListener<I, O>> processListeners = new LinkedHashSet<>();
private Set<SkipListener<I, O>> skipListeners = new LinkedHashSet<>();
private final Set<SkipListener<I, O>> skipListeners = new LinkedHashSet<>();
//
// Additional

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2022 the original author or authors.
* Copyright 2006-2023 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.
@@ -54,7 +54,7 @@ public abstract class AbstractJobExplorerFactoryBean implements FactoryBean<JobE
private TransactionAttributeSource transactionAttributeSource;
private ProxyFactory proxyFactory = new ProxyFactory();
private final ProxyFactory proxyFactory = new ProxyFactory();
/**
* Creates a job instance data access object (DAO).

View File

@@ -70,7 +70,7 @@ public class JobExplorerFactoryBean extends AbstractJobExplorerFactoryBean imple
private String tablePrefix = AbstractJdbcBatchMetadataDao.DEFAULT_TABLE_PREFIX;
private DataFieldMaxValueIncrementer incrementer = new AbstractDataFieldMaxValueIncrementer() {
private final DataFieldMaxValueIncrementer incrementer = new AbstractDataFieldMaxValueIncrementer() {
@Override
protected long getNextKey() {
throw new IllegalStateException("JobExplorer is read only.");

View File

@@ -82,7 +82,7 @@ public abstract class AbstractJob implements Job, StepLocator, BeanNameAware, In
private JobRepository jobRepository;
private CompositeJobExecutionListener listener = new CompositeJobExecutionListener();
private final CompositeJobExecutionListener listener = new CompositeJobExecutionListener();
private JobParametersIncrementer jobParametersIncrementer;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2019 the original author or authors.
* Copyright 2006-2023 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.
@@ -43,7 +43,7 @@ import org.springframework.batch.core.step.StepLocator;
*/
public class SimpleJob extends AbstractJob {
private List<Step> steps = new ArrayList<>();
private final List<Step> steps = new ArrayList<>();
/**
* Default constructor for job with null name

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2023 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.
@@ -47,27 +47,28 @@ import org.springframework.core.task.TaskExecutor;
*
* @author Dave Syer
* @author Michael Minella
* @author Mahmoud Ben Hassine
* @since 2.2
* @param <Q> the type of object returned by the builder (by default a Flow)
*
*/
public class FlowBuilder<Q> {
private String name;
private final String name;
private String prefix;
private final String prefix;
private List<StateTransition> transitions = new ArrayList<>();
private final List<StateTransition> transitions = new ArrayList<>();
private Map<String, State> tos = new HashMap<>();
private final Map<String, State> tos = new HashMap<>();
private State currentState;
private EndState failedState;
private final EndState failedState;
private EndState completedState;
private final EndState completedState;
private EndState stoppedState;
private final EndState stoppedState;
private int stepCounter = 0;
@@ -79,7 +80,7 @@ public class FlowBuilder<Q> {
private int endCounter = 0;
private Map<Object, State> states = new HashMap<>();
private final Map<Object, State> states = new HashMap<>();
private SimpleFlow flow;
@@ -606,7 +607,7 @@ public class FlowBuilder<Q> {
private final FlowBuilder<Q> parent;
private TaskExecutor executor;
private final TaskExecutor executor;
/**
* @param parent the parent builder

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2013 the original author or authors.
* Copyright 2012-2023 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.
@@ -22,11 +22,12 @@ import org.springframework.beans.factory.InitializingBean;
/**
* @author Dave Syer
* @author Mahmoud Ben Hassine
*
*/
public class JobFlowBuilder extends FlowBuilder<FlowJobBuilder> {
private FlowJobBuilder parent;
private final FlowJobBuilder parent;
public JobFlowBuilder(FlowJobBuilder parent) {
super(parent.getName());

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2013 the original author or authors.
* Copyright 2012-2023 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.
@@ -27,12 +27,13 @@ import org.springframework.util.Assert;
/**
* @author Dave Syer
* @author Mahmoud Ben Hassine
* @since 2.2
*
*/
public class SimpleJobBuilder extends JobBuilderHelper<SimpleJobBuilder> {
private List<Step> steps = new ArrayList<>();
private final List<Step> steps = new ArrayList<>();
private JobFlowBuilder builder;

View File

@@ -42,7 +42,7 @@ public class FlowJob extends AbstractJob {
protected Flow flow;
private Map<String, Step> stepMap = new ConcurrentHashMap<>();
private final Map<String, Step> stepMap = new ConcurrentHashMap<>();
private volatile boolean initialized = false;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2021 the original author or authors.
* Copyright 2006-2023 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.
@@ -56,9 +56,9 @@ public class SimpleFlow implements Flow, InitializingBean {
private State startState;
private Map<String, Set<StateTransition>> transitionMap = new HashMap<>();
private final Map<String, Set<StateTransition>> transitionMap = new HashMap<>();
private Map<String, State> stateMap = new HashMap<>();
private final Map<String, State> stateMap = new HashMap<>();
private List<StateTransition> stateTransitions = new ArrayList<>();

View File

@@ -46,7 +46,7 @@ public class SplitState extends AbstractState implements FlowHolder {
private TaskExecutor taskExecutor = new SyncTaskExecutor();
private FlowExecutionAggregator aggregator = new MaxValueFlowExecutionAggregator();
private final FlowExecutionAggregator aggregator = new MaxValueFlowExecutionAggregator();
/**
* @param flows collection of {@link Flow} instances.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2022 the original author or authors.
* Copyright 2022-2023 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.
@@ -65,7 +65,7 @@ public class JobOperatorFactoryBean implements FactoryBean<JobOperator>, Initial
private JobParametersConverter jobParametersConverter = new DefaultJobParametersConverter();
private ProxyFactory proxyFactory = new ProxyFactory();
private final ProxyFactory proxyFactory = new ProxyFactory();
@Override
public void afterPropertiesSet() throws Exception {

View File

@@ -69,7 +69,7 @@ public class JobRegistryBackgroundJobRunner {
*/
public static final String EMBEDDED = JobRegistryBackgroundJobRunner.class.getSimpleName() + ".EMBEDDED";
private static Log logger = LogFactory.getLog(JobRegistryBackgroundJobRunner.class);
private static final Log logger = LogFactory.getLog(JobRegistryBackgroundJobRunner.class);
private JobLoader jobLoader;
@@ -81,7 +81,7 @@ public class JobRegistryBackgroundJobRunner {
private JobRegistry jobRegistry;
private static List<Exception> errors = Collections.synchronizedList(new ArrayList<>());
private static final List<Exception> errors = Collections.synchronizedList(new ArrayList<>());
/**
* @param parentContextPath the parentContextPath to be used by the

View File

@@ -38,7 +38,7 @@ public class SimpleJvmExitCodeMapper implements ExitCodeMapper {
protected Log logger = LogFactory.getLog(getClass());
private Map<String, Integer> mapping;
private final Map<String, Integer> mapping;
public SimpleJvmExitCodeMapper() {
mapping = new HashMap<>();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2022 the original author or authors.
* Copyright 2006-2023 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.
@@ -25,11 +25,12 @@ import org.springframework.core.Ordered;
/**
* @author Lucas Ward
* @author Mahmoud Ben Hassine
*
*/
public class CompositeChunkListener implements ChunkListener {
private OrderedComposite<ChunkListener> listeners = new OrderedComposite<>();
private final OrderedComposite<ChunkListener> listeners = new OrderedComposite<>();
/**
* Default constructor

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2018 the original author or authors.
* Copyright 2006-2023 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.
@@ -29,7 +29,7 @@ import org.springframework.lang.Nullable;
*/
public class CompositeItemProcessListener<T, S> implements ItemProcessListener<T, S> {
private OrderedComposite<ItemProcessListener<? super T, ? super S>> listeners = new OrderedComposite<>();
private final OrderedComposite<ItemProcessListener<? super T, ? super S>> listeners = new OrderedComposite<>();
/**
* Public setter for the listeners.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2013 the original author or authors.
* Copyright 2006-2023 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.
@@ -24,11 +24,12 @@ import org.springframework.core.Ordered;
/**
* @author Lucas Ward
* @author Dave Syer
* @author Mahmoud Ben Hassine
*
*/
public class CompositeItemReadListener<T> implements ItemReadListener<T> {
private OrderedComposite<ItemReadListener<? super T>> listeners = new OrderedComposite<>();
private final OrderedComposite<ItemReadListener<? super T>> listeners = new OrderedComposite<>();
/**
* Public setter for the listeners.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2022 the original author or authors.
* Copyright 2006-2023 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.
@@ -30,7 +30,7 @@ import org.springframework.core.Ordered;
*/
public class CompositeItemWriteListener<S> implements ItemWriteListener<S> {
private OrderedComposite<ItemWriteListener<? super S>> listeners = new OrderedComposite<>();
private final OrderedComposite<ItemWriteListener<? super S>> listeners = new OrderedComposite<>();
/**
* Public setter for the listeners.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2013 the original author or authors.
* Copyright 2006-2023 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.
@@ -24,11 +24,12 @@ import org.springframework.core.Ordered;
/**
* @author Dave Syer
* @author Mahmoud Ben Hassine
*
*/
public class CompositeJobExecutionListener implements JobExecutionListener {
private OrderedComposite<JobExecutionListener> listeners = new OrderedComposite<>();
private final OrderedComposite<JobExecutionListener> listeners = new OrderedComposite<>();
/**
* Public setter for the listeners.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2013 the original author or authors.
* Copyright 2006-2023 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.
@@ -23,11 +23,12 @@ import org.springframework.core.Ordered;
/**
* @author Dave Syer
* @author Mahmoud Ben Hassine
*
*/
public class CompositeSkipListener<T, S> implements SkipListener<T, S> {
private OrderedComposite<SkipListener<? super T, ? super S>> listeners = new OrderedComposite<>();
private final OrderedComposite<SkipListener<? super T, ? super S>> listeners = new OrderedComposite<>();
/**
* Public setter for the listeners.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2019 the original author or authors.
* Copyright 2006-2023 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.
@@ -27,11 +27,12 @@ import org.springframework.lang.Nullable;
/**
* @author Lucas Ward
* @author Dave Syer
* @author Mahmoud Ben Hassine
*
*/
public class CompositeStepExecutionListener implements StepExecutionListener {
private OrderedComposite<StepExecutionListener> list = new OrderedComposite<>();
private final OrderedComposite<StepExecutionListener> list = new OrderedComposite<>();
/**
* Public setter for the listeners.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2022 the original author or authors.
* Copyright 2006-2023 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.
@@ -41,17 +41,17 @@ import org.springframework.lang.Nullable;
public class MulticasterBatchListener<T, S> implements StepExecutionListener, ChunkListener, ItemReadListener<T>,
ItemProcessListener<T, S>, ItemWriteListener<S>, SkipListener<T, S> {
private CompositeStepExecutionListener stepListener = new CompositeStepExecutionListener();
private final CompositeStepExecutionListener stepListener = new CompositeStepExecutionListener();
private CompositeChunkListener chunkListener = new CompositeChunkListener();
private final CompositeChunkListener chunkListener = new CompositeChunkListener();
private CompositeItemReadListener<T> itemReadListener = new CompositeItemReadListener<>();
private final CompositeItemReadListener<T> itemReadListener = new CompositeItemReadListener<>();
private CompositeItemProcessListener<T, S> itemProcessListener = new CompositeItemProcessListener<>();
private final CompositeItemProcessListener<T, S> itemProcessListener = new CompositeItemProcessListener<>();
private CompositeItemWriteListener<S> itemWriteListener = new CompositeItemWriteListener<>();
private final CompositeItemWriteListener<S> itemWriteListener = new CompositeItemWriteListener<>();
private CompositeSkipListener<T, S> skipListener = new CompositeSkipListener<>();
private final CompositeSkipListener<T, S> skipListener = new CompositeSkipListener<>();
/**
* Initialize the listener instance.

View File

@@ -33,13 +33,13 @@ import org.springframework.core.annotation.Order;
*/
class OrderedComposite<S> {
private List<S> unordered = new ArrayList<>();
private final List<S> unordered = new ArrayList<>();
private List<S> ordered = new ArrayList<>();
private final List<S> ordered = new ArrayList<>();
private Comparator<? super S> comparator = new AnnotationAwareOrderComparator();
private final Comparator<? super S> comparator = new AnnotationAwareOrderComparator();
private List<S> list = new ArrayList<>();
private final List<S> list = new ArrayList<>();
/**
* Public setter for the listeners.

View File

@@ -129,7 +129,7 @@ public class JdbcJobInstanceDao extends AbstractJdbcBatchMetadataDao implements
private DataFieldMaxValueIncrementer jobInstanceIncrementer;
private JobKeyGenerator<JobParameters> jobKeyGenerator = new DefaultJobKeyGenerator();
private final JobKeyGenerator<JobParameters> jobKeyGenerator = new DefaultJobKeyGenerator();
/**
* In this JDBC implementation a job instance id is obtained by asking the
@@ -235,7 +235,7 @@ public class JdbcJobInstanceDao extends AbstractJdbcBatchMetadataDao implements
ResultSetExtractor<List<JobInstance>> extractor = new ResultSetExtractor<>() {
private List<JobInstance> list = new ArrayList<>();
private final List<JobInstance> list = new ArrayList<>();
@Override
public List<JobInstance> extractData(ResultSet rs) throws SQLException, DataAccessException {
@@ -372,7 +372,7 @@ public class JdbcJobInstanceDao extends AbstractJdbcBatchMetadataDao implements
public List<JobInstance> findJobInstancesByName(String jobName, final int start, final int count) {
@SuppressWarnings("rawtypes")
ResultSetExtractor extractor = new ResultSetExtractor() {
private List<JobInstance> list = new ArrayList<>();
private final List<JobInstance> list = new ArrayList<>();
@Override
public Object extractData(ResultSet rs) throws SQLException, DataAccessException {

View File

@@ -55,7 +55,7 @@ public abstract class AbstractJobRepositoryFactoryBean implements FactoryBean<Jo
private TransactionAttributeSource transactionAttributeSource;
private ProxyFactory proxyFactory = new ProxyFactory();
private final ProxyFactory proxyFactory = new ProxyFactory();
private String isolationLevelForCreate = DEFAULT_ISOLATION_LEVEL;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2013 the original author or authors.
* Copyright 2006-2023 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.
@@ -52,13 +52,14 @@ import org.springframework.beans.factory.config.Scope;
* @author Dave Syer
* @author Jimmy Praet (create JobScope based on {@link StepScope})
* @author Michael Minella
* @author Mahmoud Ben Hassine
* @since 3.0
*/
public class JobScope extends BatchScopeSupport {
private static final String TARGET_NAME_PREFIX = "jobScopedTarget.";
private Log logger = LogFactory.getLog(getClass());
private final Log logger = LogFactory.getLog(getClass());
private final Object mutex = new Object();

View File

@@ -59,13 +59,14 @@ import org.springframework.beans.factory.config.Scope;
*
* @author Dave Syer
* @author Michael Minella
* @author Mahmoud Ben Hassine
* @since 2.0
*/
public class StepScope extends BatchScopeSupport {
private static final String TARGET_NAME_PREFIX = "scopedTarget.";
private Log logger = LogFactory.getLog(getClass());
private final Log logger = LogFactory.getLog(getClass());
private final Object mutex = new Object();

View File

@@ -49,9 +49,9 @@ import org.springframework.util.Assert;
*/
public class JobContext extends SynchronizedAttributeAccessor {
private JobExecution jobExecution;
private final JobExecution jobExecution;
private Map<String, Set<Runnable>> callbacks = new HashMap<>();
private final Map<String, Set<Runnable>> callbacks = new HashMap<>();
public JobContext(JobExecution jobExecution) {
super();

View File

@@ -51,9 +51,9 @@ import org.springframework.util.Assert;
*/
public class StepContext extends SynchronizedAttributeAccessor {
private StepExecution stepExecution;
private final StepExecution stepExecution;
private Map<String, Set<Runnable>> callbacks = new HashMap<>();
private final Map<String, Set<Runnable>> callbacks = new HashMap<>();
/**
* Create a new instance of {@link StepContext} for this {@link StepExecution}.

View File

@@ -74,7 +74,7 @@ public abstract class AbstractStep implements Step, InitializingBean, BeanNameAw
private boolean allowStartIfComplete = false;
private CompositeStepExecutionListener stepExecutionListener = new CompositeStepExecutionListener();
private final CompositeStepExecutionListener stepExecutionListener = new CompositeStepExecutionListener();
private JobRepository jobRepository;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 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.
@@ -62,7 +62,7 @@ public abstract class AbstractTaskletStepBuilder<B extends AbstractTaskletStepBu
private TransactionAttribute transactionAttribute;
private Set<ItemStream> streams = new LinkedHashSet<>();
private final Set<ItemStream> streams = new LinkedHashSet<>();
private ExceptionHandler exceptionHandler = new DefaultExceptionHandler();

View File

@@ -94,7 +94,7 @@ import org.springframework.util.Assert;
*/
public class FaultTolerantStepBuilder<I, O> extends SimpleStepBuilder<I, O> {
private ChunkMonitor chunkMonitor = new ChunkMonitor();
private final ChunkMonitor chunkMonitor = new ChunkMonitor();
private boolean streamIsReader;
@@ -102,7 +102,7 @@ public class FaultTolerantStepBuilder<I, O> extends SimpleStepBuilder<I, O> {
private BackOffPolicy backOffPolicy;
private Set<RetryListener> retryListeners = new LinkedHashSet<>();
private final Set<RetryListener> retryListeners = new LinkedHashSet<>();
private RetryPolicy retryPolicy;
@@ -110,17 +110,17 @@ public class FaultTolerantStepBuilder<I, O> extends SimpleStepBuilder<I, O> {
private KeyGenerator keyGenerator;
private Collection<Class<? extends Throwable>> noRollbackExceptionClasses = new LinkedHashSet<>();
private final Collection<Class<? extends Throwable>> noRollbackExceptionClasses = new LinkedHashSet<>();
private Map<Class<? extends Throwable>, Boolean> skippableExceptionClasses = new HashMap<>();
private final Map<Class<? extends Throwable>, Boolean> skippableExceptionClasses = new HashMap<>();
private Collection<Class<? extends Throwable>> nonSkippableExceptionClasses = new HashSet<>();
private Map<Class<? extends Throwable>, Boolean> retryableExceptionClasses = new HashMap<>();
private final Map<Class<? extends Throwable>, Boolean> retryableExceptionClasses = new HashMap<>();
private Collection<Class<? extends Throwable>> nonRetryableExceptionClasses = new HashSet<>();
private Set<SkipListener<? super I, ? super O>> skipListeners = new LinkedHashSet<>();
private final Set<SkipListener<? super I, ? super O>> skipListeners = new LinkedHashSet<>();
private int skipLimit = 0;
@@ -696,7 +696,7 @@ public class FaultTolerantStepBuilder<I, O> extends SimpleStepBuilder<I, O> {
*/
private static class TerminateOnExceptionChunkListenerDelegate implements ChunkListener {
private ChunkListener chunkListener;
private final ChunkListener chunkListener;
TerminateOnExceptionChunkListenerDelegate(ChunkListener chunkListener) {
this.chunkListener = chunkListener;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2013 the original author or authors.
* Copyright 2006-2023 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,11 +31,12 @@ import org.springframework.batch.item.support.CompositeItemStream;
* wrapped {@link ItemStream}.
*
* @author Dave Syer
* @author Mahmoud Ben Hassine
* @since 2.0
*/
public class ChunkMonitor extends ItemStreamSupport {
private Log logger = LogFactory.getLog(getClass());
private final Log logger = LogFactory.getLog(getClass());
private boolean streamsRegistered = false;
@@ -54,9 +55,9 @@ public class ChunkMonitor extends ItemStreamSupport {
private static final String OFFSET = "OFFSET";
private CompositeItemStream stream = new CompositeItemStream();
private final CompositeItemStream stream = new CompositeItemStream();
private ThreadLocal<ChunkMonitorData> holder = new ThreadLocal<>();
private final ThreadLocal<ChunkMonitorData> holder = new ThreadLocal<>();
private ItemReader<?> reader;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2022 the original author or authors.
* Copyright 2006-2023 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.
@@ -42,7 +42,7 @@ public class ChunkOrientedTasklet<I> implements Tasklet {
private boolean buffering = true;
private static Log logger = LogFactory.getLog(ChunkOrientedTasklet.class);
private static final Log logger = LogFactory.getLog(ChunkOrientedTasklet.class);
public ChunkOrientedTasklet(ChunkProvider<I> chunkProvider, ChunkProcessor<I> chunkProcessor) {
this.chunkProvider = chunkProvider;

View File

@@ -61,7 +61,7 @@ public class FaultTolerantChunkProcessor<I, O> extends SimpleChunkProcessor<I, O
private Classifier<Throwable, Boolean> rollbackClassifier = new BinaryExceptionClassifier(true);
private Log logger = LogFactory.getLog(getClass());
private final Log logger = LogFactory.getLog(getClass());
private boolean buffering = true;

View File

@@ -79,12 +79,12 @@ public class TaskletStep extends AbstractStep {
private RepeatOperations stepOperations = new RepeatTemplate();
private CompositeChunkListener chunkListener = new CompositeChunkListener();
private final CompositeChunkListener chunkListener = new CompositeChunkListener();
// default to checking current thread for interruption.
private StepInterruptionPolicy interruptionPolicy = new ThreadStepInterruptionPolicy();
private CompositeItemStream stream = new CompositeItemStream();
private final CompositeItemStream stream = new CompositeItemStream();
private PlatformTransactionManager transactionManager;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2022 the original author or authors.
* Copyright 2006-2023 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.
@@ -218,7 +218,7 @@ public class JobScopeConfigurationTests {
public static class Wrapper {
private SimpleHolder value;
private final SimpleHolder value;
public Wrapper(SimpleHolder value) {
this.value = value;

View File

@@ -238,7 +238,7 @@ public class StepScopeConfigurationTests {
public static class Wrapper {
private SimpleHolder value;
private final SimpleHolder value;
public Wrapper(SimpleHolder value) {
this.value = value;

View File

@@ -83,7 +83,7 @@ public class PartitionStepParserTests implements ApplicationContextAware {
private ApplicationContext applicationContext;
private List<String> savedStepNames = new ArrayList<>();
private final List<String> savedStepNames = new ArrayList<>();
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2019 the original author or authors.
* Copyright 2006-2023 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.
@@ -44,7 +44,7 @@ import org.springframework.util.ClassUtils;
*/
public class JobSupport implements BeanNameAware, Job, StepLocator {
private Map<String, Step> steps = new HashMap<>();
private final Map<String, Step> steps = new HashMap<>();
private String name;

View File

@@ -537,7 +537,7 @@ class SimpleJobTests {
private Throwable exception;
private JobRepository jobRepository;
private final JobRepository jobRepository;
private ExecutionContext passedInStepContext;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2022 the original author or authors.
* Copyright 2010-2023 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.
@@ -50,7 +50,7 @@ import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder;
*/
class FlowJobFailureTests {
private FlowJob job = new FlowJob();
private final FlowJob job = new FlowJob();
private JobExecution execution;

View File

@@ -170,7 +170,7 @@ class CommandLineJobRunnerTests {
@Test
void testWithStdinCommandLine() throws Throwable {
System.setIn(new InputStream() {
char[] input = (jobPath + "\n" + jobName + "\nfoo=bar\nspam=bucket").toCharArray();
final char[] input = (jobPath + "\n" + jobName + "\nfoo=bar\nspam=bucket").toCharArray();
int index = 0;
@@ -192,7 +192,7 @@ class CommandLineJobRunnerTests {
@Test
void testWithStdinCommandLineWithEmptyLines() throws Throwable {
System.setIn(new InputStream() {
char[] input = (jobPath + "\n" + jobName + "\nfoo=bar\n\nspam=bucket\n\n").toCharArray();
final char[] input = (jobPath + "\n" + jobName + "\nfoo=bar\n\nspam=bucket\n\n").toCharArray();
int index = 0;
@@ -215,7 +215,7 @@ class CommandLineJobRunnerTests {
void testWithStdinParameters() throws Throwable {
String[] args = new String[] { jobPath, jobName };
System.setIn(new InputStream() {
char[] input = ("foo=bar\nspam=bucket").toCharArray();
final char[] input = ("foo=bar\nspam=bucket").toCharArray();
int index = 0;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2022 the original author or authors.
* Copyright 2022-2023 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.
@@ -39,17 +39,17 @@ import org.springframework.transaction.interceptor.TransactionInterceptor;
*/
class JobOperatorFactoryBeanTests {
private PlatformTransactionManager transactionManager = Mockito.mock(PlatformTransactionManager.class);
private final PlatformTransactionManager transactionManager = Mockito.mock(PlatformTransactionManager.class);
private JobRepository jobRepository = Mockito.mock(JobRepository.class);
private final JobRepository jobRepository = Mockito.mock(JobRepository.class);
private JobLauncher jobLauncher = Mockito.mock(JobLauncher.class);
private final JobLauncher jobLauncher = Mockito.mock(JobLauncher.class);
private JobRegistry jobRegistry = Mockito.mock(JobRegistry.class);
private final JobRegistry jobRegistry = Mockito.mock(JobRegistry.class);
private JobExplorer jobExplorer = Mockito.mock(JobExplorer.class);
private final JobExplorer jobExplorer = Mockito.mock(JobExplorer.class);
private JobParametersConverter jobParametersConverter = Mockito.mock(JobParametersConverter.class);
private final JobParametersConverter jobParametersConverter = Mockito.mock(JobParametersConverter.class);
@Test
public void testJobOperatorCreation() throws Exception {

View File

@@ -229,7 +229,7 @@ class ItemListenerErrorTests {
private boolean goingToFail = false;
private ItemReader<String> delegate = new ListItemReader<>(Collections.singletonList("1"));
private final ItemReader<String> delegate = new ListItemReader<>(Collections.singletonList("1"));
private int count = 0;

View File

@@ -550,7 +550,7 @@ class MulticasterBatchListenerTests {
private static final class AnnotationBasedStepListener {
private IllegalStateException exception = new IllegalStateException("listener error");
private final IllegalStateException exception = new IllegalStateException("listener error");
@BeforeRead
public void beforeRead() {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2008-2019 the original author or authors.
* Copyright 2008-2023 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.
@@ -29,9 +29,9 @@ import org.springframework.util.ClassUtils;
*/
public class ExampleItemReader extends AbstractItemStreamItemReader<String> {
private Log logger = LogFactory.getLog(getClass());
private final Log logger = LogFactory.getLog(getClass());
private String[] input = { "Hello", "world!", "Go", "on", "punk", "make", "my", "day!" };
private final String[] input = { "Hello", "world!", "Go", "on", "punk", "make", "my", "day!" };
private int index = 0;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2008-2022 the original author or authors.
* Copyright 2008-2023 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,7 +31,7 @@ public class ExampleItemWriter implements ItemWriter<String> {
private static final Log log = LogFactory.getLog(ExampleItemWriter.class);
private static List<String> items = new ArrayList<>();
private static final List<String> items = new ArrayList<>();
public static void clear() {
items.clear();

View File

@@ -44,7 +44,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
*/
class PartitionStepTests {
private PartitionStep step = new PartitionStep();
private final PartitionStep step = new PartitionStep();
private JobRepository jobRepository;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2009-2022 the original author or authors.
* Copyright 2009-2023 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.
@@ -101,7 +101,7 @@ class NonAbstractStepTests {
*/
private class EventTrackingListener implements StepExecutionListener {
private String name;
private final String name;
public EventTrackingListener(String name) {
this.name = name;

View File

@@ -260,7 +260,7 @@ class RegisterMultiListenerTests {
private static class MultiListener
implements StepExecutionListener, ChunkListener, ItemWriteListener<String>, SkipListener<String, String> {
private CallChecker callChecker;
private final CallChecker callChecker;
private MultiListener(CallChecker callChecker) {
super();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2019 the original author or authors.
* Copyright 2006-2023 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.
@@ -29,15 +29,16 @@ import org.springframework.lang.Nullable;
/**
* @author Dan Garrette
* @author Mahmoud Ben Hassine
* @since 2.0.2
*/
public class ExceptionThrowingTaskletStub implements Tasklet {
private int maxTries = 4;
private final int maxTries = 4;
protected Log logger = LogFactory.getLog(getClass());
private List<Integer> committed = TransactionAwareProxyFactory.createTransactionalList();
private final List<Integer> committed = TransactionAwareProxyFactory.createTransactionalList();
private Constructor<? extends Exception> exception;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2008-2022 the original author or authors.
* Copyright 2008-2023 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.
@@ -126,7 +126,7 @@ class FaultTolerantStepFactoryBeanNonBufferingTests {
protected final Log logger = LogFactory.getLog(getClass());
// simulate transactional output
private List<Object> written = TransactionAwareProxyFactory.createTransactionalList();
private final List<Object> written = TransactionAwareProxyFactory.createTransactionalList();
private final Collection<String> failures;

View File

@@ -73,13 +73,13 @@ class FaultTolerantStepFactoryBeanRetryTests {
private FaultTolerantStepFactoryBean<String, String> factory;
private List<Object> recovered = new ArrayList<>();
private final List<Object> recovered = new ArrayList<>();
private List<Object> processed = new ArrayList<>();
private final List<Object> processed = new ArrayList<>();
private List<Object> provided = new ArrayList<>();
private final List<Object> provided = new ArrayList<>();
private List<Object> written = TransactionAwareProxyFactory.createTransactionalList();
private final List<Object> written = TransactionAwareProxyFactory.createTransactionalList();
int count = 0;
@@ -89,7 +89,7 @@ class FaultTolerantStepFactoryBeanRetryTests {
JobExecution jobExecution;
private ItemWriter<String> writer = data -> processed.addAll(data.getItems());
private final ItemWriter<String> writer = data -> processed.addAll(data.getItems());
@SuppressWarnings("unchecked")
@BeforeEach

View File

@@ -278,7 +278,7 @@ class SimpleStepFactoryBeanTests {
int failedCount = 0;
private AssertingWriteListener writeListener;
private final AssertingWriteListener writeListener;
public CountingChunkListener(AssertingWriteListener writeListener) {
super();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2019 the original author or authors.
* Copyright 2006-2023 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.
@@ -24,13 +24,14 @@ import org.springframework.lang.Nullable;
/**
* @author Dan Garrette
* @author Mahmoud Ben Hassine
* @since 2.0.1
*/
public class SkipProcessorStub<T> extends AbstractExceptionThrowingItemHandlerStub<T> implements ItemProcessor<T, T> {
private List<T> processed = new ArrayList<>();
private final List<T> processed = new ArrayList<>();
private List<T> committed = TransactionAwareProxyFactory.createTransactionalList();
private final List<T> committed = TransactionAwareProxyFactory.createTransactionalList();
private boolean filter = false;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2019 the original author or authors.
* Copyright 2006-2023 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.
@@ -26,13 +26,14 @@ import org.springframework.util.Assert;
/**
* @author Dan Garrette
* @author Mahmoud Ben Hassine
* @since 2.0.1
*/
public class SkipReaderStub<T> extends AbstractExceptionThrowingItemHandlerStub<T> implements ItemReader<T> {
private T[] items;
private List<T> read = new ArrayList<>();
private final List<T> read = new ArrayList<>();
private int counter = -1;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2022 the original author or authors.
* Copyright 2006-2023 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.
@@ -29,9 +29,9 @@ import org.springframework.batch.support.transaction.TransactionAwareProxyFactor
*/
public class SkipWriterStub<T> extends AbstractExceptionThrowingItemHandlerStub<T> implements ItemWriter<T> {
private List<T> written = new ArrayList<>();
private final List<T> written = new ArrayList<>();
private List<T> committed = TransactionAwareProxyFactory.createTransactionalList();
private final List<T> committed = TransactionAwareProxyFactory.createTransactionalList();
public SkipWriterStub() throws Exception {
super();

View File

@@ -934,7 +934,7 @@ class TaskletStepTests {
private boolean getExecutionAttributesCalled = false;
private boolean restoreFromCalled = false;
private final boolean restoreFromCalled = false;
@Nullable
@Override

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2019 the original author or authors.
* Copyright 2006-2023 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.
@@ -40,7 +40,7 @@ import org.springframework.util.ClassUtils;
*/
public class JobSupport implements BeanNameAware, Job {
private List<Step> steps = new ArrayList<>();
private final List<Step> steps = new ArrayList<>();
private String name;

View File

@@ -199,11 +199,11 @@ class FaultTolerantStepFactoryBeanIntegrationTests {
private static class SkipWriterStub implements ItemWriter<String> {
private List<String> written = new ArrayList<>();
private final List<String> written = new ArrayList<>();
private Collection<String> failures = Collections.emptySet();
private final Collection<String> failures = Collections.emptySet();
private JdbcTemplate jdbcTemplate;
private final JdbcTemplate jdbcTemplate;
public SkipWriterStub(DataSource dataSource) {
jdbcTemplate = new JdbcTemplate(dataSource);
@@ -240,9 +240,9 @@ class FaultTolerantStepFactoryBeanIntegrationTests {
private final Log logger = LogFactory.getLog(getClass());
private List<String> processed = new ArrayList<>();
private final List<String> processed = new ArrayList<>();
private JdbcTemplate jdbcTemplate;
private final JdbcTemplate jdbcTemplate;
/**
* @param dataSource

View File

@@ -221,11 +221,11 @@ class FaultTolerantStepFactoryBeanRollbackIntegrationTests {
private static class SkipWriterStub implements ItemWriter<String> {
private List<String> written = new CopyOnWriteArrayList<>();
private final List<String> written = new CopyOnWriteArrayList<>();
private Collection<String> failures = Collections.emptySet();
private JdbcTemplate jdbcTemplate;
private final JdbcTemplate jdbcTemplate;
public SkipWriterStub(DataSource dataSource) {
jdbcTemplate = new JdbcTemplate(dataSource);
@@ -266,9 +266,9 @@ class FaultTolerantStepFactoryBeanRollbackIntegrationTests {
private final Log logger = LogFactory.getLog(getClass());
private List<String> processed = new CopyOnWriteArrayList<>();
private final List<String> processed = new CopyOnWriteArrayList<>();
private JdbcTemplate jdbcTemplate;
private final JdbcTemplate jdbcTemplate;
/**
* @param dataSource

View File

@@ -58,9 +58,9 @@ public class AvroItemReader<T> extends AbstractItemCountingItemStreamItemReader<
private DataFileStream<T> dataFileReader;
private InputStream inputStream;
private final InputStream inputStream;
private DatumReader<T> datumReader;
private final DatumReader<T> datumReader;
/**
* @param resource the {@link Resource} containing objects serialized with Avro.

View File

@@ -58,11 +58,11 @@ public class AvroItemWriter<T> extends AbstractItemStreamItemWriter<T> {
private OutputStreamWriter<T> outputStreamWriter;
private WritableResource resource;
private final WritableResource resource;
private Resource schemaResource;
private final Resource schemaResource;
private Class<T> clazz;
private final Class<T> clazz;
private boolean embedSchema = true;

View File

@@ -44,7 +44,7 @@ public abstract class AbstractPaginatedDataItemReader<T> extends AbstractItemCou
protected Iterator<T> results;
private Object lock = new Object();
private final Object lock = new Object();
/**
* The number of items to be read with each page.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2017-2020 the original author or authors.
* Copyright 2017-2023 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.
@@ -128,9 +128,9 @@ public class RepositoryItemWriterBuilder<T> {
*/
public static class RepositoryMethodReference<T> {
private RepositoryMethodInterceptor repositoryInvocationHandler;
private final RepositoryMethodInterceptor repositoryInvocationHandler;
private CrudRepository<?, ?> repository;
private final CrudRepository<?, ?> repository;
public RepositoryMethodReference(CrudRepository<?, ?> repository) {
this.repository = repository;

View File

@@ -58,7 +58,7 @@ public abstract class AbstractPagingItemReader<T> extends AbstractItemCountingIt
protected volatile List<T> results;
private Object lock = new Object();
private final Object lock = new Object();
public AbstractPagingItemReader() {
setName(ClassUtils.getShortName(AbstractPagingItemReader.class));

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2022 the original author or authors.
* Copyright 2006-2023 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.
@@ -59,7 +59,7 @@ import org.springframework.util.ClassUtils;
public class HibernateCursorItemReader<T> extends AbstractItemCountingItemStreamItemReader<T>
implements InitializingBean {
private HibernateItemReaderHelper<T> helper = new HibernateItemReaderHelper<>();
private final HibernateItemReaderHelper<T> helper = new HibernateItemReaderHelper<>();
public HibernateCursorItemReader() {
setName(ClassUtils.getShortName(HibernateCursorItemReader.class));

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2022 the original author or authors.
* Copyright 2006-2023 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.
@@ -58,7 +58,7 @@ import org.springframework.util.ClassUtils;
@Deprecated(since = "5.0", forRemoval = true)
public class HibernatePagingItemReader<T> extends AbstractPagingItemReader<T> implements InitializingBean {
private HibernateItemReaderHelper<T> helper = new HibernateItemReaderHelper<>();
private final HibernateItemReaderHelper<T> helper = new HibernateItemReaderHelper<>();
private Map<String, Object> parameterValues;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2022 the original author or authors.
* Copyright 2006-2023 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.
@@ -64,7 +64,7 @@ import static org.springframework.batch.support.DatabaseType.SYBASE;
*/
public class DefaultDataFieldMaxValueIncrementerFactory implements DataFieldMaxValueIncrementerFactory {
private DataSource dataSource;
private final DataSource dataSource;
private String incrementerColumnName = "ID";

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2022 the original author or authors.
* Copyright 2006-2023 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.
@@ -70,7 +70,7 @@ public class SqlPagingQueryProviderFactoryBean implements FactoryBean<PagingQuer
private Map<String, Order> sortKeys;
private Map<DatabaseType, AbstractSqlPagingQueryProvider> providers = new HashMap<>();
private final Map<DatabaseType, AbstractSqlPagingQueryProvider> providers = new HashMap<>();
{
providers.put(DB2, new Db2PagingQueryProvider());

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2007 the original author or authors.
* Copyright 2006-2023 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.
@@ -24,11 +24,12 @@ import org.springframework.batch.item.ParseException;
*
* @author Lucas Ward
* @author Ben Hale
* @author Mahmoud Ben Hassine
*/
@SuppressWarnings("serial")
public class FlatFileParseException extends ParseException {
private String input;
private final String input;
private int lineNumber;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2007 the original author or authors.
* Copyright 2006-2023 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.
@@ -21,11 +21,12 @@ import org.springframework.batch.item.NonTransientResourceException;
* Exception thrown when errors are encountered with the underlying resource.
*
* @author Dave Syer
* @author Mahmoud Ben Hassine
*/
@SuppressWarnings("serial")
public class NonTransientFlatFileException extends NonTransientResourceException {
private String input;
private final String input;
private int lineNumber;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2009-2021 the original author or authors.
* Copyright 2009-2023 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.
@@ -50,7 +50,7 @@ public class ResourcesItemReader extends AbstractItemStreamItemReader<Resource>
private Resource[] resources = new Resource[0];
private AtomicInteger counter = new AtomicInteger(0);
private final AtomicInteger counter = new AtomicInteger(0);
public ResourcesItemReader() {
/*

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016-2022 the original author or authors.
* Copyright 2016-2023 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.
@@ -97,7 +97,7 @@ public class FlatFileItemReaderBuilder<T> {
private BeanFactory beanFactory;
private Map<Class<?>, PropertyEditor> customEditors = new HashMap<>();
private final Map<Class<?>, PropertyEditor> customEditors = new HashMap<>();
private int distanceLimit = 5;
@@ -521,19 +521,19 @@ public class FlatFileItemReaderBuilder<T> {
*/
public static class DelimitedBuilder<T> {
private FlatFileItemReaderBuilder<T> parent;
private final FlatFileItemReaderBuilder<T> parent;
private List<String> names = new ArrayList<>();
private final List<String> names = new ArrayList<>();
private String delimiter;
private Character quoteCharacter;
private List<Integer> includedFields = new ArrayList<>();
private final List<Integer> includedFields = new ArrayList<>();
private FieldSetFactory fieldSetFactory = new DefaultFieldSetFactory();
private boolean strict = true;
private final boolean strict = true;
protected DelimitedBuilder(FlatFileItemReaderBuilder<T> parent) {
this.parent = parent;
@@ -665,11 +665,11 @@ public class FlatFileItemReaderBuilder<T> {
*/
public static class FixedLengthBuilder<T> {
private FlatFileItemReaderBuilder<T> parent;
private final FlatFileItemReaderBuilder<T> parent;
private List<Range> ranges = new ArrayList<>();
private final List<Range> ranges = new ArrayList<>();
private List<String> names = new ArrayList<>();
private final List<String> names = new ArrayList<>();
private boolean strict = true;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016-2022 the original author or authors.
* Copyright 2016-2023 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.
@@ -277,7 +277,7 @@ public class FlatFileItemWriterBuilder<T> {
*/
public static class FormattedBuilder<T> {
private FlatFileItemWriterBuilder<T> parent;
private final FlatFileItemWriterBuilder<T> parent;
private String format;
@@ -289,7 +289,7 @@ public class FlatFileItemWriterBuilder<T> {
private FieldExtractor<T> fieldExtractor;
private List<String> names = new ArrayList<>();
private final List<String> names = new ArrayList<>();
private Class<T> sourceType;
@@ -418,9 +418,9 @@ public class FlatFileItemWriterBuilder<T> {
*/
public static class DelimitedBuilder<T> {
private FlatFileItemWriterBuilder<T> parent;
private final FlatFileItemWriterBuilder<T> parent;
private List<String> names = new ArrayList<>();
private final List<String> names = new ArrayList<>();
private String delimiter = ",";

View File

@@ -99,7 +99,7 @@ public class BeanWrapperFieldSetMapper<T> extends DefaultPropertyEditorRegistrar
private BeanFactory beanFactory;
private ConcurrentMap<DistanceHolder, ConcurrentMap<String, String>> propertiesMatched = new ConcurrentHashMap<>();
private final ConcurrentMap<DistanceHolder, ConcurrentMap<String, String>> propertiesMatched = new ConcurrentHashMap<>();
private int distanceLimit = 5;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2009-2014 the original author or authors.
* Copyright 2009-2023 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.
@@ -42,7 +42,7 @@ import org.springframework.batch.item.file.LineMapper;
*/
public class JsonLineMapper implements LineMapper<Map<String, Object>> {
private MappingJsonFactory factory = new MappingJsonFactory();
private final MappingJsonFactory factory = new MappingJsonFactory();
/**
* Interpret the line as a Json object and create a Map from it.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2022 the original author or authors.
* Copyright 2006-2023 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.
@@ -41,11 +41,12 @@ import org.springframework.util.Assert;
* @see PatternMatchingCompositeLineTokenizer
* @author Dan Garrette
* @author Dave Syer
* @author Mahmoud Ben Hassine
* @since 2.0
*/
public class PatternMatchingCompositeLineMapper<T> implements LineMapper<T>, InitializingBean {
private PatternMatchingCompositeLineTokenizer tokenizer = new PatternMatchingCompositeLineTokenizer();
private final PatternMatchingCompositeLineTokenizer tokenizer = new PatternMatchingCompositeLineTokenizer();
private PatternMatcher<FieldSetMapper<T>> patternMatcher;

View File

@@ -73,7 +73,7 @@ final class PropertyMatches {
private final String propertyName;
private String[] possibleMatches;
private final String[] possibleMatches;
/**
* Create a new PropertyMatches instance for the given property.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2019 the original author or authors.
* Copyright 2006-2023 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,6 +31,7 @@ import org.springframework.util.StringUtils;
* @author Robert Kasanicky
* @author Lucas Ward
* @author Michael Minella
* @author Mahmoud Ben Hassine
*/
public abstract class AbstractLineTokenizer implements LineTokenizer {
@@ -38,7 +39,7 @@ public abstract class AbstractLineTokenizer implements LineTokenizer {
private boolean strict = true;
private String emptyToken = "";
private final String emptyToken = "";
private FieldSetFactory fieldSetFactory = new DefaultFieldSetFactory();

View File

@@ -59,7 +59,7 @@ public class DefaultFieldSet implements FieldSet {
/**
* The fields wrapped by this '<code>FieldSet</code>' instance.
*/
private String[] tokens;
private final String[] tokens;
private List<String> names;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2008 the original author or authors.
* Copyright 2006-2023 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.
@@ -20,14 +20,15 @@ package org.springframework.batch.item.file.transform;
*
* @author Lucas Ward
* @author Michael Minella
* @author Mahmoud Ben Hassine
* @since 1.1
*/
@SuppressWarnings("serial")
public class IncorrectLineLengthException extends FlatFileFormatException {
private int actualLength;
private final int actualLength;
private int expectedLength;
private final int expectedLength;
/**
* @param message the message for this exception.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2014 the original author or authors.
* Copyright 2006-2023 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.
@@ -21,14 +21,15 @@ package org.springframework.batch.item.file.transform;
*
* @author Lucas Ward
* @author "Michael Minella"
* @author Mahmoud Ben Hassine
* @since 1.1
*/
@SuppressWarnings("serial")
public class IncorrectTokenCountException extends FlatFileFormatException {
private int actualCount;
private final int actualCount;
private int expectedCount;
private final int expectedCount;
private String input;

View File

@@ -36,9 +36,9 @@ public class RecordFieldExtractor<T> implements FieldExtractor<T> {
private List<String> names;
private Class<? extends T> targetType;
private final Class<? extends T> targetType;
private RecordComponent[] recordComponents;
private final RecordComponent[] recordComponents;
public RecordFieldExtractor(Class<? extends T> targetType) {
Assert.notNull(targetType, "target type must not be null");

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2019-2020 the original author or authors.
* Copyright 2019-2023 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.
@@ -56,13 +56,13 @@ public class KafkaItemReader<K, V> extends AbstractItemStreamItemReader<V> {
private static final long DEFAULT_POLL_TIMEOUT = 30L;
private List<TopicPartition> topicPartitions;
private final List<TopicPartition> topicPartitions;
private Map<TopicPartition, Long> partitionOffsets;
private KafkaConsumer<K, V> kafkaConsumer;
private Properties consumerProperties;
private final Properties consumerProperties;
private Iterator<ConsumerRecord<K, V>> consumerRecords;

View File

@@ -32,11 +32,12 @@ import org.springframework.lang.Nullable;
*
* @author Dave Syer
* @author jojoldu
* @author Mahmoud Ben Hassine
*
*/
public class ListItemReader<T> implements ItemReader<T> {
private List<T> list;
private final List<T> list;
public ListItemReader(List<T> list) {
// If it is a proxy we assume it knows how to deal with its own state.

View File

@@ -33,7 +33,7 @@ import java.util.List;
*/
public class ListItemWriter<T> implements ItemWriter<T> {
private List<T> writtenItems = new ArrayList<>();
private final List<T> writtenItems = new ArrayList<>();
@Override
public void write(Chunk<? extends T> chunk) throws Exception {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2018-2021 the original author or authors.
* Copyright 2018-2023 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.
@@ -32,7 +32,7 @@ import org.springframework.validation.beanvalidation.SpringValidatorAdapter;
*/
public class BeanValidatingItemProcessor<T> extends ValidatingItemProcessor<T> {
private Validator validator;
private final Validator validator;
/**
* Create a new instance of {@link BeanValidatingItemProcessor} with the default

View File

@@ -51,7 +51,7 @@ public class StaxEventItemReaderBuilder<T> {
private Unmarshaller unmarshaller;
private List<String> fragmentRootElements = new ArrayList<>();
private final List<String> fragmentRootElements = new ArrayList<>();
private boolean saveState = true;

Some files were not shown because too many files have changed in this diff Show More