Skip to content

Commit 95ac319

Browse files
committed
Polish
1 parent 955888b commit 95ac319

File tree

8 files changed

+15
-15
lines changed

8 files changed

+15
-15
lines changed

spring-batch-core/src/main/java/org/springframework/batch/core/job/builder/SimpleJobBuilder.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2023 the original author or authors.
2+
* Copyright 2012-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -83,7 +83,7 @@ public SimpleJobBuilder start(Step step) {
8383
* @return a builder for fluent chaining
8484
*/
8585
public FlowBuilder.TransitionBuilder<FlowJobBuilder> on(String pattern) {
86-
Assert.state(steps.size() > 0, "You have to start a job with a step");
86+
Assert.state(!steps.isEmpty(), "You have to start a job with a step");
8787
for (Step step : steps) {
8888
if (builder == null) {
8989
builder = new JobFlowBuilder(new FlowJobBuilder(this), step);

spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/JdbcExecutionContextDao.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2006-2023 the original author or authors.
2+
* Copyright 2006-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -156,7 +156,7 @@ public ExecutionContext getExecutionContext(JobExecution jobExecution) {
156156

157157
List<ExecutionContext> results = getJdbcTemplate().query(getQuery(FIND_JOB_EXECUTION_CONTEXT),
158158
new ExecutionContextRowMapper(), executionId);
159-
if (results.size() > 0) {
159+
if (!results.isEmpty()) {
160160
return results.get(0);
161161
}
162162
else {

spring-batch-core/src/main/java/org/springframework/batch/core/step/builder/AbstractTaskletStepBuilder.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2023 the original author or authors.
2+
* Copyright 2012-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -180,7 +180,7 @@ public B listener(Object listener) {
180180
chunkListenerMethods.addAll(ReflectionUtils.findMethod(listener.getClass(), AfterChunk.class));
181181
chunkListenerMethods.addAll(ReflectionUtils.findMethod(listener.getClass(), AfterChunkError.class));
182182

183-
if (chunkListenerMethods.size() > 0) {
183+
if (!chunkListenerMethods.isEmpty()) {
184184
StepListenerFactoryBean factory = new StepListenerFactoryBean();
185185
factory.setDelegate(listener);
186186
this.listener((ChunkListener) factory.getObject());

spring-batch-core/src/main/java/org/springframework/batch/core/step/builder/FaultTolerantStepBuilder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ public FaultTolerantStepBuilder<I, O> listener(Object listener) {
199199
skipListenerMethods.addAll(ReflectionUtils.findMethod(listener.getClass(), OnSkipInProcess.class));
200200
skipListenerMethods.addAll(ReflectionUtils.findMethod(listener.getClass(), OnSkipInWrite.class));
201201

202-
if (skipListenerMethods.size() > 0) {
202+
if (!skipListenerMethods.isEmpty()) {
203203
StepListenerFactoryBean factory = new StepListenerFactoryBean();
204204
factory.setDelegate(listener);
205205
skipListeners.add((SkipListener<I, O>) factory.getObject());

spring-batch-core/src/main/java/org/springframework/batch/core/step/builder/SimpleStepBuilder.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2006-2023 the original author or authors.
2+
* Copyright 2006-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -269,7 +269,7 @@ public SimpleStepBuilder<I, O> listener(Object listener) {
269269
itemListenerMethods.addAll(ReflectionUtils.findMethod(listener.getClass(), OnProcessError.class));
270270
itemListenerMethods.addAll(ReflectionUtils.findMethod(listener.getClass(), OnWriteError.class));
271271

272-
if (itemListenerMethods.size() > 0) {
272+
if (!itemListenerMethods.isEmpty()) {
273273
StepListenerFactoryBean factory = new StepListenerFactoryBean();
274274
factory.setDelegate(listener);
275275
itemListeners.add((StepListener) factory.getObject());

spring-batch-infrastructure/src/main/java/org/springframework/batch/item/data/RepositoryItemReader.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ protected List<T> doPageRead() throws Exception {
229229

230230
List<Object> parameters = new ArrayList<>();
231231

232-
if (arguments != null && arguments.size() > 0) {
232+
if (arguments != null && !arguments.isEmpty()) {
233233
parameters.addAll(arguments);
234234
}
235235

spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/JdbcPagingItemReader.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2006-2022 the original author or authors.
2+
* Copyright 2006-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -185,7 +185,7 @@ protected void doReadPage() {
185185
if (logger.isDebugEnabled()) {
186186
logger.debug("SQL used for reading first page: [" + firstPageSql + "]");
187187
}
188-
if (parameterValues != null && parameterValues.size() > 0) {
188+
if (parameterValues != null && !parameterValues.isEmpty()) {
189189
if (this.queryProvider.isUsingNamedParameters()) {
190190
query = namedParameterJdbcTemplate.query(firstPageSql, getParameterMap(parameterValues, null),
191191
rowCallback);
@@ -277,7 +277,7 @@ private List<Object> getParameterList(Map<String, Object> values, Map<String, Ob
277277
}
278278
List<Object> parameterList = new ArrayList<>();
279279
parameterList.addAll(sm.values());
280-
if (sortKeyValue != null && sortKeyValue.size() > 0) {
280+
if (sortKeyValue != null && !sortKeyValue.isEmpty()) {
281281
List<Map.Entry<String, Object>> keys = new ArrayList<>(sortKeyValue.entrySet());
282282

283283
for (int i = 0; i < keys.size(); i++) {

spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/support/AbstractSqlPagingQueryProvider.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2006-2023 the original author or authors.
2+
* Copyright 2006-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -194,7 +194,7 @@ public void init(DataSource dataSource) throws Exception {
194194
}
195195
List<String> namedParameters = new ArrayList<>();
196196
parameterCount = JdbcParameterUtils.countParameterPlaceholders(sql.toString(), namedParameters);
197-
if (namedParameters.size() > 0) {
197+
if (!namedParameters.isEmpty()) {
198198
if (parameterCount != namedParameters.size()) {
199199
throw new InvalidDataAccessApiUsageException(
200200
"You can't use both named parameters and classic \"?\" placeholders: " + sql);

0 commit comments

Comments
 (0)