Use diamond operator where appropriate

This commit is contained in:
Mahmoud Ben Hassine
2023-06-05 13:48:31 +02:00
parent 0dc5b63469
commit 92159cbc2b
105 changed files with 411 additions and 403 deletions

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.
@@ -38,6 +38,7 @@ import org.springframework.core.task.TaskRejectedException;
* subflows.
*
* @author Dave Syer
* @author Mahmoud Ben Hassine
* @since 2.0
*/
public class SplitState extends AbstractState implements FlowHolder {
@@ -88,7 +89,7 @@ public class SplitState extends AbstractState implements FlowHolder {
for (final Flow flow : flows) {
final FutureTask<FlowExecution> task = new FutureTask<>(new Callable<FlowExecution>() {
final FutureTask<FlowExecution> task = new FutureTask<>(new Callable<>() {
@Override
public FlowExecution call() throws Exception {
return flow.start(executor);

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.
@@ -43,6 +43,7 @@ import org.springframework.util.Assert;
*
* @author Sebastien Gerard
* @author Dave Syer
* @author Mahmoud Ben Hassine
* @since 2.0
*/
public class TaskExecutorPartitionHandler extends AbstractPartitionHandler implements StepHolder, InitializingBean {
@@ -128,7 +129,7 @@ public class TaskExecutorPartitionHandler extends AbstractPartitionHandler imple
* @return the task executing the given step
*/
protected FutureTask<StepExecution> createTask(final Step step, final StepExecution stepExecution) {
return new FutureTask<>(new Callable<StepExecution>() {
return new FutureTask<>(new Callable<>() {
@Override
public StepExecution call() throws Exception {
step.execute(stepExecution);

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.
@@ -142,7 +142,7 @@ public class Jackson2ExecutionContextStringSerializer implements ExecutionContex
public Map<String, Object> deserialize(InputStream in) throws IOException {
TypeReference<HashMap<String, Object>> typeRef = new TypeReference<HashMap<String, Object>>() {
TypeReference<HashMap<String, Object>> typeRef = new TypeReference<>() {
};
return objectMapper.readValue(in, typeRef);
}

View File

@@ -221,7 +221,7 @@ public class JdbcJobInstanceDao extends AbstractJdbcBatchMetadataDao implements
*/
@Override
public List<String> getJobNames() {
return getJdbcTemplate().query(getQuery(FIND_JOB_NAMES), new RowMapper<String>() {
return getJdbcTemplate().query(getQuery(FIND_JOB_NAMES), new RowMapper<>() {
@Override
public String mapRow(ResultSet rs, int rowNum) throws SQLException {
return rs.getString(1);
@@ -238,7 +238,7 @@ public class JdbcJobInstanceDao extends AbstractJdbcBatchMetadataDao implements
@Override
public List<JobInstance> getJobInstances(String jobName, final int start, final int count) {
ResultSetExtractor<List<JobInstance>> extractor = new ResultSetExtractor<List<JobInstance>>() {
ResultSetExtractor<List<JobInstance>> extractor = new ResultSetExtractor<>() {
private List<JobInstance> list = new ArrayList<>();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2013-2021 the original author or authors.
* Copyright 2013-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.
@@ -33,7 +33,7 @@ import org.springframework.lang.Nullable;
*/
public class JobSynchronizationManager {
private static final SynchronizationManagerSupport<JobExecution, JobContext> manager = new SynchronizationManagerSupport<JobExecution, JobContext>() {
private static final SynchronizationManagerSupport<JobExecution, JobContext> manager = new SynchronizationManagerSupport<>() {
@Override
protected JobContext createNewContext(JobExecution execution) {

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.
@@ -33,7 +33,7 @@ import org.springframework.lang.Nullable;
*/
public class StepSynchronizationManager {
private static final SynchronizationManagerSupport<StepExecution, StepContext> manager = new SynchronizationManagerSupport<StepExecution, StepContext>() {
private static final SynchronizationManagerSupport<StepExecution, StepContext> manager = new SynchronizationManagerSupport<>() {
@Override
protected StepContext createNewContext(StepExecution execution) {

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.
@@ -215,7 +215,7 @@ public class FaultTolerantChunkProcessor<I, O> extends SimpleChunkProcessor<I, O
final I item = iterator.next();
RetryCallback<O, Exception> retryCallback = new RetryCallback<O, Exception>() {
RetryCallback<O, Exception> retryCallback = new RetryCallback<>() {
@Override
public O doWithRetry(RetryContext context) throws Exception {
@@ -274,7 +274,7 @@ public class FaultTolerantChunkProcessor<I, O> extends SimpleChunkProcessor<I, O
};
RecoveryCallback<O> recoveryCallback = new RecoveryCallback<O>() {
RecoveryCallback<O> recoveryCallback = new RecoveryCallback<>() {
@Override
public O recover(RetryContext context) throws Exception {
@@ -328,7 +328,7 @@ public class FaultTolerantChunkProcessor<I, O> extends SimpleChunkProcessor<I, O
final UserData<O> data = (UserData<O>) inputs.getUserData();
final AtomicReference<RetryContext> contextHolder = new AtomicReference<>();
RetryCallback<Object, Exception> retryCallback = new RetryCallback<Object, Exception>() {
RetryCallback<Object, Exception> retryCallback = new RetryCallback<>() {
@Override
public Object doWithRetry(RetryContext context) throws Exception {
contextHolder.set(context);
@@ -368,7 +368,7 @@ public class FaultTolerantChunkProcessor<I, O> extends SimpleChunkProcessor<I, O
if (!buffering) {
RecoveryCallback<Object> batchRecoveryCallback = new RecoveryCallback<Object>() {
RecoveryCallback<Object> batchRecoveryCallback = new RecoveryCallback<>() {
@Override
public Object recover(RetryContext context) throws Exception {
@@ -406,7 +406,7 @@ public class FaultTolerantChunkProcessor<I, O> extends SimpleChunkProcessor<I, O
}
else {
RecoveryCallback<Object> recoveryCallback = new RecoveryCallback<Object>() {
RecoveryCallback<Object> recoveryCallback = new RecoveryCallback<>() {
@Override
public Object recover(RetryContext context) throws Exception {

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.
@@ -100,7 +100,7 @@ public class SystemCommandTasklet implements StepExecutionListener, StoppableTas
@Override
public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) throws Exception {
FutureTask<Integer> systemCommandTask = new FutureTask<>(new Callable<Integer>() {
FutureTask<Integer> systemCommandTask = new FutureTask<>(new Callable<>() {
@Override
public Integer call() throws Exception {