Use diamond operator where appropriate
This commit is contained in:
@@ -84,7 +84,7 @@ public class StagingItemReader<T>
|
||||
|
||||
"SELECT ID FROM BATCH_STAGING WHERE JOB_ID=? AND PROCESSED=? ORDER BY ID",
|
||||
|
||||
new RowMapper<Long>() {
|
||||
new RowMapper<>() {
|
||||
@Override
|
||||
public Long mapRow(ResultSet rs, int rowNum) throws SQLException {
|
||||
return rs.getLong(1);
|
||||
|
||||
@@ -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,12 +21,13 @@ package org.springframework.batch.sample.domain.multiline;
|
||||
*
|
||||
* @see AggregateItemReader
|
||||
* @author Dave Syer
|
||||
* @author Mahmoud Ben Hassine
|
||||
*
|
||||
*/
|
||||
public class AggregateItem<T> {
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
private static final AggregateItem FOOTER = new AggregateItem<Object>(false, true) {
|
||||
private static final AggregateItem FOOTER = new AggregateItem<>(false, true) {
|
||||
@Override
|
||||
public Object getItem() {
|
||||
throw new IllegalStateException("Footer record has no item.");
|
||||
@@ -43,7 +44,7 @@ public class AggregateItem<T> {
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
private static final AggregateItem HEADER = new AggregateItem<Object>(true, false) {
|
||||
private static final AggregateItem HEADER = new AggregateItem<>(true, false) {
|
||||
@Override
|
||||
public Object getItem() {
|
||||
throw new IllegalStateException("Header record has no item.");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2019-2022 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.
|
||||
@@ -49,7 +49,7 @@ public class SkippableExceptionDuringProcessSample {
|
||||
|
||||
@Bean
|
||||
public ItemReader<Integer> itemReader() {
|
||||
return new ListItemReader<Integer>(Arrays.asList(1, 2, 3, 4, 5, 6)) {
|
||||
return new ListItemReader<>(Arrays.asList(1, 2, 3, 4, 5, 6)) {
|
||||
@Override
|
||||
public Integer read() {
|
||||
Integer item = super.read();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2019-2022 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.
|
||||
@@ -49,7 +49,7 @@ public class SkippableExceptionDuringReadSample {
|
||||
|
||||
@Bean
|
||||
public ItemReader<Integer> itemReader() {
|
||||
return new ListItemReader<Integer>(Arrays.asList(1, 2, 3, 4, 5, 6)) {
|
||||
return new ListItemReader<>(Arrays.asList(1, 2, 3, 4, 5, 6)) {
|
||||
@Override
|
||||
public Integer read() {
|
||||
Integer item = super.read();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2019-2022 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.
|
||||
@@ -49,7 +49,7 @@ public class SkippableExceptionDuringWriteSample {
|
||||
|
||||
@Bean
|
||||
public ItemReader<Integer> itemReader() {
|
||||
return new ListItemReader<Integer>(Arrays.asList(1, 2, 3, 4, 5, 6)) {
|
||||
return new ListItemReader<>(Arrays.asList(1, 2, 3, 4, 5, 6)) {
|
||||
@Override
|
||||
public Integer read() {
|
||||
Integer item = super.read();
|
||||
|
||||
@@ -73,7 +73,7 @@ class CompositeItemWriterSampleFunctionalTests {
|
||||
}
|
||||
|
||||
private void checkOutputTable(int before) {
|
||||
final List<Trade> trades = new ArrayList<Trade>() {
|
||||
final List<Trade> trades = new ArrayList<>() {
|
||||
{
|
||||
add(new Trade("UK21341EAH41", 211, new BigDecimal("31.11"), "customer1"));
|
||||
add(new Trade("UK21341EAH42", 212, new BigDecimal("32.11"), "customer2"));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2007-2022 the original author or authors.
|
||||
* Copyright 2007-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.
|
||||
@@ -123,18 +123,17 @@ class HibernateFailureJobFunctionalTests {
|
||||
*/
|
||||
protected void validatePreConditions() {
|
||||
ensureState();
|
||||
creditsBeforeUpdate = new TransactionTemplate(transactionManager)
|
||||
.execute(new TransactionCallback<List<BigDecimal>>() {
|
||||
@Override
|
||||
public List<BigDecimal> doInTransaction(TransactionStatus status) {
|
||||
return jdbcTemplate.query(ALL_CUSTOMERS, new RowMapper<BigDecimal>() {
|
||||
@Override
|
||||
public BigDecimal mapRow(ResultSet rs, int rowNum) throws SQLException {
|
||||
return rs.getBigDecimal(CREDIT_COLUMN);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
creditsBeforeUpdate = new TransactionTemplate(transactionManager).execute(new TransactionCallback<>() {
|
||||
@Override
|
||||
public List<BigDecimal> doInTransaction(TransactionStatus status) {
|
||||
return jdbcTemplate.query(ALL_CUSTOMERS, new RowMapper<>() {
|
||||
@Override
|
||||
public BigDecimal mapRow(ResultSet rs, int rowNum) throws SQLException {
|
||||
return rs.getBigDecimal(CREDIT_COLUMN);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -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.
|
||||
@@ -123,7 +123,7 @@ class StagingItemReaderTests {
|
||||
TransactionTemplate txTemplate = new TransactionTemplate(transactionManager);
|
||||
txTemplate.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRES_NEW);
|
||||
|
||||
final Long idToUse = txTemplate.execute(new TransactionCallback<Long>() {
|
||||
final Long idToUse = txTemplate.execute(new TransactionCallback<>() {
|
||||
@Override
|
||||
public Long doInTransaction(TransactionStatus transactionStatus) {
|
||||
|
||||
|
||||
@@ -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.
|
||||
@@ -57,7 +57,7 @@ class AggregateItemFieldSetMapperTests {
|
||||
|
||||
@Test
|
||||
void testDelegate() throws Exception {
|
||||
mapper.setDelegate(new FieldSetMapper<String>() {
|
||||
mapper.setDelegate(new FieldSetMapper<>() {
|
||||
@Override
|
||||
public String mapFieldSet(FieldSet fs) {
|
||||
return "foo";
|
||||
|
||||
@@ -33,7 +33,7 @@ class AggregateItemReaderTests {
|
||||
|
||||
@BeforeEach
|
||||
void setUp() {
|
||||
input = new ItemReader<AggregateItem<String>>() {
|
||||
input = new ItemReader<>() {
|
||||
private int count = 0;
|
||||
|
||||
@Nullable
|
||||
|
||||
@@ -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.
|
||||
@@ -79,7 +79,7 @@ class TwoJobInstancesDelimitedFunctionalTests {
|
||||
.toJobParameters();
|
||||
StepExecution stepExecution = MetaDataInstanceFactory.createStepExecution(jobParameters);
|
||||
|
||||
int count = StepScopeTestUtils.doInStepScope(stepExecution, new Callable<Integer>() {
|
||||
int count = StepScopeTestUtils.doInStepScope(stepExecution, new Callable<>() {
|
||||
@Override
|
||||
public Integer call() throws Exception {
|
||||
int count = 0;
|
||||
|
||||
Reference in New Issue
Block a user