Mark fields as final where appropriate
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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";
|
||||
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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() {
|
||||
/*
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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 = ",";
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014 the original author or authors.
|
||||
* Copyright 2014-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,11 +29,12 @@ import javax.xml.stream.events.XMLEvent;
|
||||
* not closed.
|
||||
*
|
||||
* @author Jimmy Praet
|
||||
* @author Mahmoud Ben Hassine
|
||||
* @since 3.0
|
||||
*/
|
||||
public class UnclosedElementCollectingEventWriter extends AbstractEventWriterWrapper {
|
||||
|
||||
private LinkedList<QName> unclosedElements = new LinkedList<>();
|
||||
private final LinkedList<QName> unclosedElements = new LinkedList<>();
|
||||
|
||||
public UnclosedElementCollectingEventWriter(XMLEventWriter wrappedEventWriter) {
|
||||
super(wrappedEventWriter);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2022 the original author or authors.
|
||||
* Copyright 2014-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.
|
||||
@@ -34,13 +34,14 @@ import org.springframework.util.StringUtils;
|
||||
* XMLEventWriter.
|
||||
*
|
||||
* @author Jimmy Praet
|
||||
* @author Mahmoud Ben Hassine
|
||||
* @since 3.0
|
||||
*/
|
||||
public class UnopenedElementClosingEventWriter extends AbstractEventWriterWrapper {
|
||||
|
||||
private LinkedList<QName> unopenedElements;
|
||||
private final LinkedList<QName> unopenedElements;
|
||||
|
||||
private Writer ioWriter;
|
||||
private final Writer ioWriter;
|
||||
|
||||
public UnopenedElementClosingEventWriter(XMLEventWriter wrappedEventWriter, Writer ioWriter,
|
||||
List<QName> unopenedElements) {
|
||||
|
||||
@@ -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.
|
||||
@@ -27,13 +27,14 @@ import org.springframework.batch.repeat.RepeatStatus;
|
||||
* into chunks.
|
||||
*
|
||||
* @author Dave Syer
|
||||
* @author Mahmoud Ben Hassine
|
||||
*
|
||||
*/
|
||||
public class NestedRepeatCallback implements RepeatCallback {
|
||||
|
||||
private RepeatOperations template;
|
||||
private final RepeatOperations template;
|
||||
|
||||
private RepeatCallback callback;
|
||||
private final RepeatCallback callback;
|
||||
|
||||
/**
|
||||
* Constructor setting mandatory fields.
|
||||
|
||||
@@ -27,7 +27,7 @@ import org.springframework.batch.repeat.RepeatContext;
|
||||
|
||||
public class RepeatContextSupport extends SynchronizedAttributeAccessor implements RepeatContext {
|
||||
|
||||
private RepeatContext parent;
|
||||
private final RepeatContext parent;
|
||||
|
||||
private int count;
|
||||
|
||||
@@ -35,7 +35,7 @@ public class RepeatContextSupport extends SynchronizedAttributeAccessor implemen
|
||||
|
||||
private volatile boolean terminateOnly;
|
||||
|
||||
private Map<String, Set<Runnable>> callbacks = new HashMap<>();
|
||||
private final Map<String, Set<Runnable>> callbacks = new HashMap<>();
|
||||
|
||||
/**
|
||||
* Constructor for {@link RepeatContextSupport}. The parent can be null, but should be
|
||||
|
||||
@@ -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.
|
||||
@@ -34,10 +34,11 @@ import org.springframework.beans.factory.InitializingBean;
|
||||
*
|
||||
* @author Dave Syer
|
||||
* @author Robert Kasanicky
|
||||
* @author Mahmoud Ben Hassine
|
||||
*/
|
||||
public class SimpleLimitExceptionHandler implements ExceptionHandler, InitializingBean {
|
||||
|
||||
private RethrowOnThresholdExceptionHandler delegate = new RethrowOnThresholdExceptionHandler();
|
||||
private final RethrowOnThresholdExceptionHandler delegate = new RethrowOnThresholdExceptionHandler();
|
||||
|
||||
private Collection<Class<? extends Throwable>> exceptionClasses = Collections
|
||||
.<Class<? extends Throwable>>singleton(Exception.class);
|
||||
|
||||
@@ -119,12 +119,12 @@ public class CompositeCompletionPolicy implements CompletionPolicy {
|
||||
*/
|
||||
protected class CompositeBatchContext extends RepeatContextSupport {
|
||||
|
||||
private RepeatContext[] contexts;
|
||||
private final RepeatContext[] contexts;
|
||||
|
||||
// Save a reference to the policies when we were created - gives some
|
||||
// protection against reference changes (e.g. if the number of policies
|
||||
// change).
|
||||
private CompletionPolicy[] policies;
|
||||
private final CompletionPolicy[] policies;
|
||||
|
||||
public CompositeBatchContext(RepeatContext context, List<RepeatContext> contexts) {
|
||||
super(context);
|
||||
|
||||
@@ -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.
|
||||
@@ -30,6 +30,7 @@ import org.springframework.batch.repeat.context.RepeatContextSupport;
|
||||
* than the termination policy.
|
||||
*
|
||||
* @author Dave Syer
|
||||
* @author Mahmoud Ben Hassine
|
||||
*
|
||||
*/
|
||||
public class TimeoutTerminationPolicy extends CompletionPolicySupport {
|
||||
@@ -80,7 +81,7 @@ public class TimeoutTerminationPolicy extends CompletionPolicySupport {
|
||||
|
||||
protected class TimeoutBatchContext extends RepeatContextSupport {
|
||||
|
||||
private volatile long time = System.currentTimeMillis();
|
||||
private final long time = System.currentTimeMillis();
|
||||
|
||||
private final long timeout = TimeoutTerminationPolicy.this.timeout;
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ import org.springframework.util.ReflectionUtils;
|
||||
*/
|
||||
public class AnnotationMethodResolver implements MethodResolver {
|
||||
|
||||
private Class<? extends Annotation> annotationType;
|
||||
private final Class<? extends Annotation> annotationType;
|
||||
|
||||
/**
|
||||
* Create a {@link MethodResolver} for the specified Method-level annotation type.
|
||||
|
||||
@@ -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.
|
||||
@@ -34,6 +34,7 @@ import org.springframework.transaction.support.TransactionSynchronizationManager
|
||||
* @author Dave Syer
|
||||
* @author Michael Minella
|
||||
* @author Niels Ferguson
|
||||
* @author Mahmoud Ben Hassine
|
||||
*
|
||||
*/
|
||||
public class TransactionAwareBufferedWriter extends Writer {
|
||||
@@ -42,7 +43,7 @@ public class TransactionAwareBufferedWriter extends Writer {
|
||||
|
||||
private final Object closeKey;
|
||||
|
||||
private FileChannel channel;
|
||||
private final FileChannel channel;
|
||||
|
||||
private final Runnable closeCallback;
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ public class BatchMessageListenerContainer extends DefaultMessageListenerContain
|
||||
|
||||
private Advice[] advices = new Advice[0];
|
||||
|
||||
private ContainerDelegate delegate = BatchMessageListenerContainer.super::receiveAndExecute;
|
||||
private final ContainerDelegate delegate = BatchMessageListenerContainer.super::receiveAndExecute;
|
||||
|
||||
private ContainerDelegate proxy = delegate;
|
||||
|
||||
|
||||
@@ -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.
|
||||
@@ -32,6 +32,7 @@ import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
* Tests for {@link AbstractMethodInvokingDelegator}
|
||||
*
|
||||
* @author Robert Kasanicky
|
||||
* @author Mahmoud Ben Hassine
|
||||
*/
|
||||
class AbstractDelegatorTests {
|
||||
|
||||
@@ -199,7 +200,7 @@ class AbstractDelegatorTests {
|
||||
|
||||
private String name;
|
||||
|
||||
private int value;
|
||||
private final int value;
|
||||
|
||||
public Foo(String name, int value) {
|
||||
this.name = name;
|
||||
@@ -230,7 +231,7 @@ class AbstractDelegatorTests {
|
||||
|
||||
private static class FooService {
|
||||
|
||||
private List<Foo> processedFooNameValuePairs = new ArrayList<>();
|
||||
private final List<Foo> processedFooNameValuePairs = new ArrayList<>();
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public void processNameValuePair(String name, int value) {
|
||||
|
||||
@@ -40,7 +40,7 @@ public class User extends org.apache.avro.specific.SpecificRecordBase
|
||||
return SCHEMA$;
|
||||
}
|
||||
|
||||
private static SpecificData MODEL$ = new SpecificData();
|
||||
private static final SpecificData MODEL$ = new SpecificData();
|
||||
|
||||
private static final BinaryMessageEncoder<User> ENCODER = new BinaryMessageEncoder<>(MODEL$, SCHEMA$);
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ public abstract class AvroTestFixtures {
|
||||
new User("Alana", 13, "yellow"),
|
||||
new User("Joe", 1, "pink"));
|
||||
|
||||
private Chunk<PlainOldUser> plainOldUsers = Chunk.of(
|
||||
private final Chunk<PlainOldUser> plainOldUsers = Chunk.of(
|
||||
new PlainOldUser("David", 20, "blue"),
|
||||
new PlainOldUser("Sue", 4, "red"),
|
||||
new PlainOldUser("Alana", 13, "yellow"),
|
||||
|
||||
@@ -191,7 +191,7 @@ public class JdbcBatchItemWriterNamedParameterTests {
|
||||
|
||||
public static class SqlParameterSourceArrayEquals extends BaseMatcher<SqlParameterSource[]> {
|
||||
|
||||
private SqlParameterSource[] expected;
|
||||
private final SqlParameterSource[] expected;
|
||||
|
||||
public SqlParameterSourceArrayEquals(SqlParameterSource[] expected) {
|
||||
this.expected = expected;
|
||||
|
||||
@@ -41,7 +41,7 @@ public class MultiResourceItemWriterFlatFileTests extends AbstractMultiResourceI
|
||||
*/
|
||||
private final class WriterCallback implements TransactionCallback<Void> {
|
||||
|
||||
private Chunk<? extends String> list;
|
||||
private final Chunk<? extends String> list;
|
||||
|
||||
public WriterCallback(Chunk<? extends String> list) {
|
||||
super();
|
||||
|
||||
@@ -377,7 +377,7 @@ class FlatFileItemReaderBuilderTests {
|
||||
.resource(getResource("1,2,3"))
|
||||
.delimited()
|
||||
.fieldSetFactory(new FieldSetFactory() {
|
||||
private FieldSet fieldSet = new DefaultFieldSet(new String[] { "1", "3", "foo" }, names);
|
||||
private final FieldSet fieldSet = new DefaultFieldSet(new String[] { "1", "3", "foo" }, names);
|
||||
|
||||
@Override
|
||||
public FieldSet create(String[] values, String[] names) {
|
||||
@@ -409,7 +409,7 @@ class FlatFileItemReaderBuilderTests {
|
||||
.resource(getResource("1 2 3"))
|
||||
.fixedLength()
|
||||
.fieldSetFactory(new FieldSetFactory() {
|
||||
private FieldSet fieldSet = new DefaultFieldSet(new String[] { "1", "3", "foo" }, names);
|
||||
private final FieldSet fieldSet = new DefaultFieldSet(new String[] { "1", "3", "foo" }, names);
|
||||
|
||||
@Override
|
||||
public FieldSet create(String[] values, String[] names) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2020-2022 the original author or authors.
|
||||
* Copyright 2020-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.
|
||||
@@ -71,9 +71,9 @@ class RecordFieldSetMapperTests {
|
||||
public static class Person {
|
||||
|
||||
// TODO change to record in v5
|
||||
private int id;
|
||||
private final int id;
|
||||
|
||||
private String name;
|
||||
private final String name;
|
||||
|
||||
public Person(int id, String name) {
|
||||
this.id = id;
|
||||
|
||||
@@ -107,7 +107,7 @@ class FormatterLineAggregatorTests {
|
||||
aggregator.setMaximumLength(25);
|
||||
|
||||
aggregator.setFieldExtractor(new FieldExtractor<>() {
|
||||
private int[] widths = new int[] { 13, 12 };
|
||||
private final int[] widths = new int[] { 13, 12 };
|
||||
|
||||
@Override
|
||||
public Object[] extract(String[] item) {
|
||||
@@ -140,7 +140,7 @@ class FormatterLineAggregatorTests {
|
||||
aggregator.setMaximumLength(24);
|
||||
|
||||
aggregator.setFieldExtractor(new FieldExtractor<>() {
|
||||
private int[] widths = new int[] { 13, 11 };
|
||||
private final int[] widths = new int[] { 13, 11 };
|
||||
|
||||
@Override
|
||||
public Object[] extract(String[] item) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2008-2010 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.
|
||||
@@ -24,6 +24,7 @@ import java.util.List;
|
||||
* class can be reused by the framework.
|
||||
*
|
||||
* @author Robert Kasanicky
|
||||
* @author Mahmoud Ben Hassine
|
||||
*/
|
||||
public class FooService {
|
||||
|
||||
@@ -31,11 +32,11 @@ public class FooService {
|
||||
|
||||
private int counter = 0;
|
||||
|
||||
private List<Foo> generatedFoos = new ArrayList<>(GENERATION_LIMIT);
|
||||
private final List<Foo> generatedFoos = new ArrayList<>(GENERATION_LIMIT);
|
||||
|
||||
private List<Foo> processedFoos = new ArrayList<>(GENERATION_LIMIT);
|
||||
private final List<Foo> processedFoos = new ArrayList<>(GENERATION_LIMIT);
|
||||
|
||||
private List<Foo> processedFooNameValuePairs = new ArrayList<>(GENERATION_LIMIT);
|
||||
private final List<Foo> processedFooNameValuePairs = new ArrayList<>(GENERATION_LIMIT);
|
||||
|
||||
public Foo generateFoo() {
|
||||
if (counter++ >= GENERATION_LIMIT)
|
||||
|
||||
@@ -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,6 +30,7 @@ import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
* @author Mahmoud Ben Hassine
|
||||
*
|
||||
*/
|
||||
class ItemCountingItemStreamItemReaderTests {
|
||||
@@ -132,7 +133,7 @@ class ItemCountingItemStreamItemReaderTests {
|
||||
|
||||
private boolean openCalled = false;
|
||||
|
||||
private Iterator<String> items = Arrays.asList("a", "b", "c").iterator();
|
||||
private final Iterator<String> items = Arrays.asList("a", "b", "c").iterator();
|
||||
|
||||
@Override
|
||||
protected void doClose() throws Exception {
|
||||
|
||||
@@ -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.
|
||||
@@ -113,7 +113,7 @@ class Jaxb2NamespaceUnmarshallingTests {
|
||||
reader.close();
|
||||
}
|
||||
|
||||
private static String TRADE_XML = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><trade xmlns=\"urn:org.springframework.batch.io.oxm.domain\">"
|
||||
private static final String TRADE_XML = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><trade xmlns=\"urn:org.springframework.batch.io.oxm.domain\">"
|
||||
+ "<customer>Customer1</customer><isin>XYZ0001</isin><price>11.39</price><quantity>5</quantity>"
|
||||
+ "</trade>";
|
||||
|
||||
|
||||
@@ -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.
|
||||
@@ -50,7 +50,7 @@ class ResultHolderResultQueueTests {
|
||||
|
||||
private static class TestResultHolder implements ResultHolder {
|
||||
|
||||
private RepeatStatus result;
|
||||
private final RepeatStatus result;
|
||||
|
||||
private Throwable error;
|
||||
|
||||
|
||||
@@ -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.
|
||||
@@ -22,14 +22,15 @@ import org.springframework.batch.item.file.transform.FieldSet;
|
||||
|
||||
/**
|
||||
* @author Rob Harrop
|
||||
* @author Mahmoud Ben Hassine
|
||||
*/
|
||||
public class Trade {
|
||||
|
||||
private String isin;
|
||||
private final String isin;
|
||||
|
||||
private long quantity;
|
||||
private final long quantity;
|
||||
|
||||
private BigDecimal price;
|
||||
private final BigDecimal price;
|
||||
|
||||
Trade(FieldSet fieldSet) {
|
||||
this.isin = fieldSet.readString(0);
|
||||
|
||||
Reference in New Issue
Block a user