Skip to content

Commit 167f3c4

Browse files
committed
Remove usage of raw parametrized types
1 parent 5585749 commit 167f3c4

File tree

13 files changed

+49
-49
lines changed

13 files changed

+49
-49
lines changed

spring-batch-core/src/main/java/org/springframework/batch/core/JobParametersBuilder.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public JobParametersBuilder addString(String key, @NonNull String parameter) {
105105
* @return a reference to this object.
106106
*/
107107
public JobParametersBuilder addString(String key, @NonNull String parameter, boolean identifying) {
108-
this.parameterMap.put(key, new JobParameter(parameter, String.class, identifying));
108+
this.parameterMap.put(key, new JobParameter<>(parameter, String.class, identifying));
109109
return this;
110110
}
111111

@@ -128,7 +128,7 @@ public JobParametersBuilder addDate(String key, @NonNull Date parameter) {
128128
* @return a reference to this object.
129129
*/
130130
public JobParametersBuilder addDate(String key, @NonNull Date parameter, boolean identifying) {
131-
this.parameterMap.put(key, new JobParameter(parameter, Date.class, identifying));
131+
this.parameterMap.put(key, new JobParameter<>(parameter, Date.class, identifying));
132132
return this;
133133
}
134134

@@ -151,7 +151,7 @@ public JobParametersBuilder addLocalDate(String key, @NonNull LocalDate paramete
151151
* @return a reference to this object.
152152
*/
153153
public JobParametersBuilder addLocalDate(String key, @NonNull LocalDate parameter, boolean identifying) {
154-
this.parameterMap.put(key, new JobParameter(parameter, LocalDate.class, identifying));
154+
this.parameterMap.put(key, new JobParameter<>(parameter, LocalDate.class, identifying));
155155
return this;
156156
}
157157

@@ -174,7 +174,7 @@ public JobParametersBuilder addLocalTime(String key, @NonNull LocalTime paramete
174174
* @return a reference to this object.
175175
*/
176176
public JobParametersBuilder addLocalTime(String key, @NonNull LocalTime parameter, boolean identifying) {
177-
this.parameterMap.put(key, new JobParameter(parameter, LocalTime.class, identifying));
177+
this.parameterMap.put(key, new JobParameter<>(parameter, LocalTime.class, identifying));
178178
return this;
179179
}
180180

@@ -197,7 +197,7 @@ public JobParametersBuilder addLocalDateTime(String key, @NonNull LocalDateTime
197197
* @return a reference to this object.
198198
*/
199199
public JobParametersBuilder addLocalDateTime(String key, @NonNull LocalDateTime parameter, boolean identifying) {
200-
this.parameterMap.put(key, new JobParameter(parameter, LocalDateTime.class, identifying));
200+
this.parameterMap.put(key, new JobParameter<>(parameter, LocalDateTime.class, identifying));
201201
return this;
202202
}
203203

@@ -220,7 +220,7 @@ public JobParametersBuilder addLong(String key, @NonNull Long parameter) {
220220
* @return a reference to this object.
221221
*/
222222
public JobParametersBuilder addLong(String key, @NonNull Long parameter, boolean identifying) {
223-
this.parameterMap.put(key, new JobParameter(parameter, Long.class, identifying));
223+
this.parameterMap.put(key, new JobParameter<>(parameter, Long.class, identifying));
224224
return this;
225225
}
226226

@@ -243,7 +243,7 @@ public JobParametersBuilder addDouble(String key, @NonNull Double parameter) {
243243
* @return a reference to this object.
244244
*/
245245
public JobParametersBuilder addDouble(String key, @NonNull Double parameter, boolean identifying) {
246-
this.parameterMap.put(key, new JobParameter(parameter, Double.class, identifying));
246+
this.parameterMap.put(key, new JobParameter<>(parameter, Double.class, identifying));
247247
return this;
248248
}
249249

@@ -293,7 +293,7 @@ public JobParametersBuilder addJobParameter(String key, JobParameter<?> jobParam
293293
* @since 5.0
294294
*/
295295
public <T> JobParametersBuilder addJobParameter(String name, T value, Class<T> type, boolean identifying) {
296-
return addJobParameter(name, new JobParameter(value, type, identifying));
296+
return addJobParameter(name, new JobParameter<>(value, type, identifying));
297297
}
298298

299299
/**

spring-batch-core/src/test/java/org/springframework/batch/core/JobParametersTests.java

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,14 @@ void setUp() throws Exception {
5454
private JobParameters getNewParameters() {
5555

5656
Map<String, JobParameter<?>> parameterMap = new HashMap<>();
57-
parameterMap.put("string.key1", new JobParameter("value1", String.class, true));
58-
parameterMap.put("string.key2", new JobParameter("value2", String.class, true));
59-
parameterMap.put("long.key1", new JobParameter(1L, Long.class, true));
60-
parameterMap.put("long.key2", new JobParameter(2L, Long.class, true));
61-
parameterMap.put("double.key1", new JobParameter(1.1, Double.class, true));
62-
parameterMap.put("double.key2", new JobParameter(2.2, Double.class, true));
63-
parameterMap.put("date.key1", new JobParameter(date1, Date.class, true));
64-
parameterMap.put("date.key2", new JobParameter(date2, Date.class, true));
57+
parameterMap.put("string.key1", new JobParameter<>("value1", String.class, true));
58+
parameterMap.put("string.key2", new JobParameter<>("value2", String.class, true));
59+
parameterMap.put("long.key1", new JobParameter<>(1L, Long.class, true));
60+
parameterMap.put("long.key2", new JobParameter<>(2L, Long.class, true));
61+
parameterMap.put("double.key1", new JobParameter<>(1.1, Double.class, true));
62+
parameterMap.put("double.key2", new JobParameter<>(2.2, Double.class, true));
63+
parameterMap.put("date.key1", new JobParameter<>(date1, Date.class, true));
64+
parameterMap.put("date.key2", new JobParameter<>(date2, Date.class, true));
6565

6666
return new JobParameters(parameterMap);
6767
}
@@ -148,14 +148,14 @@ void testToStringOrder() {
148148
String string1 = stringBuilder.toString();
149149

150150
Map<String, JobParameter<?>> parameterMap = new HashMap<>();
151-
parameterMap.put("string.key2", new JobParameter("value2", String.class, true));
152-
parameterMap.put("string.key1", new JobParameter("value1", String.class, true));
153-
parameterMap.put("long.key2", new JobParameter(2L, Long.class, true));
154-
parameterMap.put("long.key1", new JobParameter(1L, Long.class, true));
155-
parameterMap.put("double.key2", new JobParameter(2.2, Double.class, true));
156-
parameterMap.put("double.key1", new JobParameter(1.1, Double.class, true));
157-
parameterMap.put("date.key2", new JobParameter(date2, Date.class, true));
158-
parameterMap.put("date.key1", new JobParameter(date1, Date.class, true));
151+
parameterMap.put("string.key2", new JobParameter<>("value2", String.class, true));
152+
parameterMap.put("string.key1", new JobParameter<>("value1", String.class, true));
153+
parameterMap.put("long.key2", new JobParameter<>(2L, Long.class, true));
154+
parameterMap.put("long.key1", new JobParameter<>(1L, Long.class, true));
155+
parameterMap.put("double.key2", new JobParameter<>(2.2, Double.class, true));
156+
parameterMap.put("double.key1", new JobParameter<>(1.1, Double.class, true));
157+
parameterMap.put("date.key2", new JobParameter<>(date2, Date.class, true));
158+
parameterMap.put("date.key1", new JobParameter<>(date1, Date.class, true));
159159

160160
JobParameters testProps = new JobParameters(parameterMap);
161161

spring-batch-core/src/test/java/org/springframework/batch/core/repository/dao/AbstractExecutionContextSerializerTests.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ void testSerializeAMap() throws Exception {
6565
@Test
6666
void testSerializeStringJobParameter() throws Exception {
6767
Map<String, Object> m1 = new HashMap<>();
68-
m1.put("name", new JobParameter("foo", String.class));
68+
m1.put("name", new JobParameter<>("foo", String.class));
6969

7070
Map<String, Object> m2 = serializationRoundTrip(m1);
7171

@@ -75,7 +75,7 @@ void testSerializeStringJobParameter() throws Exception {
7575
@Test
7676
void testSerializeDateJobParameter() throws Exception {
7777
Map<String, Object> m1 = new HashMap<>();
78-
m1.put("birthDate", new JobParameter(new Date(123456790123L), Date.class));
78+
m1.put("birthDate", new JobParameter<>(new Date(123456790123L), Date.class));
7979

8080
Map<String, Object> m2 = serializationRoundTrip(m1);
8181

@@ -85,7 +85,7 @@ void testSerializeDateJobParameter() throws Exception {
8585
@Test
8686
void testSerializeDoubleJobParameter() throws Exception {
8787
Map<String, Object> m1 = new HashMap<>();
88-
m1.put("weight", new JobParameter(80.5D, Double.class));
88+
m1.put("weight", new JobParameter<>(80.5D, Double.class));
8989

9090
Map<String, Object> m2 = serializationRoundTrip(m1);
9191

@@ -95,7 +95,7 @@ void testSerializeDoubleJobParameter() throws Exception {
9595
@Test
9696
void testSerializeLongJobParameter() throws Exception {
9797
Map<String, Object> m1 = new HashMap<>();
98-
m1.put("age", new JobParameter(20L, Long.class));
98+
m1.put("age", new JobParameter<>(20L, Long.class));
9999

100100
Map<String, Object> m2 = serializationRoundTrip(m1);
101101

@@ -105,7 +105,7 @@ void testSerializeLongJobParameter() throws Exception {
105105
@Test
106106
void testSerializeNonIdentifyingJobParameter() throws Exception {
107107
Map<String, Object> m1 = new HashMap<>();
108-
m1.put("name", new JobParameter("foo", String.class, false));
108+
m1.put("name", new JobParameter<>("foo", String.class, false));
109109

110110
Map<String, Object> m2 = serializationRoundTrip(m1);
111111

@@ -115,7 +115,7 @@ void testSerializeNonIdentifyingJobParameter() throws Exception {
115115
@Test
116116
void testSerializeJobParameters() throws Exception {
117117
Map<String, JobParameter<?>> jobParametersMap = new HashMap<>();
118-
jobParametersMap.put("paramName", new JobParameter("paramValue", String.class));
118+
jobParametersMap.put("paramName", new JobParameter<>("paramValue", String.class));
119119

120120
Map<String, Object> m1 = new HashMap<>();
121121
m1.put("params", new JobParameters(jobParametersMap));

spring-batch-core/src/test/java/org/springframework/batch/core/repository/dao/JdbcJobExecutionDaoTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ void testDeleteJobExecution() {
9696
void testDeleteJobExecutionParameters() {
9797
// given
9898
Map<String, JobParameter<?>> parameters = new HashMap<>();
99-
parameters.put("string-param", new JobParameter("value", String.class));
99+
parameters.put("string-param", new JobParameter<>("value", String.class));
100100
JobExecution execution = new JobExecution(jobInstance, new JobParameters(parameters));
101101
dao.saveJobExecution(execution);
102102

spring-batch-core/src/test/java/org/springframework/batch/core/scope/context/ChunkContextTests.java

Lines changed: 2 additions & 2 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-2023 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.
@@ -36,7 +36,7 @@
3636
class ChunkContextTests {
3737

3838
private final ChunkContext context = new ChunkContext(new StepContext(new JobExecution(new JobInstance(0L, "job"),
39-
1L, new JobParameters(Collections.singletonMap("foo", new JobParameter("bar", String.class))))
39+
1L, new JobParameters(Collections.singletonMap("foo", new JobParameter<>("bar", String.class))))
4040
.createStepExecution("foo")));
4141

4242
@Test

spring-batch-infrastructure/src/test/java/org/springframework/batch/item/avro/support/AvroTestFixtures.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2019-2022 the original author or authors.
2+
* Copyright 2019-2023 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.
@@ -91,7 +91,7 @@ protected Chunk<User> avroGeneratedUsers() {
9191
}
9292

9393
protected Chunk<GenericRecord> genericAvroGeneratedUsers() {
94-
return new Chunk(this.avroGeneratedUsers.getItems().stream().map(u -> {
94+
return new Chunk<>(this.avroGeneratedUsers.getItems().stream().map(u -> {
9595
GenericData.Record avroRecord;
9696
avroRecord = new GenericData.Record(u.getSchema());
9797
avroRecord.put("name", u.getName());
@@ -106,7 +106,7 @@ protected Chunk<PlainOldUser> plainOldUsers() {
106106
}
107107

108108
protected Chunk<GenericRecord> genericPlainOldUsers() {
109-
return new Chunk(
109+
return new Chunk<>(
110110
this.plainOldUsers.getItems().stream().map(PlainOldUser::toGenericRecord).collect(Collectors.toList()));
111111
}
112112

spring-batch-integration/src/test/java/org/springframework/batch/integration/chunk/RemoteChunkFaultTolerantStepIntegrationTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ void drain() {
5757
@Test
5858
void testFailedStep() throws Exception {
5959
JobExecution jobExecution = jobLauncher.run(job, new JobParameters(
60-
Collections.singletonMap("item.three", new JobParameter("unsupported", String.class))));
60+
Collections.singletonMap("item.three", new JobParameter<>("unsupported", String.class))));
6161
assertEquals(BatchStatus.FAILED, jobExecution.getStatus());
6262
StepExecution stepExecution = jobExecution.getStepExecutions().iterator().next();
6363
assertEquals(9, stepExecution.getReadCount());
@@ -68,7 +68,7 @@ void testFailedStep() throws Exception {
6868
@Test
6969
void testFailedStepOnError() throws Exception {
7070
JobExecution jobExecution = jobLauncher.run(job,
71-
new JobParameters(Collections.singletonMap("item.three", new JobParameter("error", String.class))));
71+
new JobParameters(Collections.singletonMap("item.three", new JobParameter<>("error", String.class))));
7272
assertEquals(BatchStatus.FAILED, jobExecution.getStatus());
7373
StepExecution stepExecution = jobExecution.getStepExecutions().iterator().next();
7474
assertEquals(9, stepExecution.getReadCount());

spring-batch-integration/src/test/java/org/springframework/batch/integration/chunk/RemoteChunkFaultTolerantStepJdbcIntegrationTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ void drain() {
6262
@DirtiesContext
6363
void testFailedStep() throws Exception {
6464
JobExecution jobExecution = jobLauncher.run(job, new JobParameters(
65-
Collections.singletonMap("item.three", new JobParameter("unsupported", String.class))));
65+
Collections.singletonMap("item.three", new JobParameter<>("unsupported", String.class))));
6666
assertEquals(BatchStatus.FAILED, jobExecution.getStatus());
6767
StepExecution stepExecution = jobExecution.getStepExecutions().iterator().next();
6868
assertEquals(9, stepExecution.getReadCount());
@@ -74,7 +74,7 @@ void testFailedStep() throws Exception {
7474
@DirtiesContext
7575
void testFailedStepOnError() throws Exception {
7676
JobExecution jobExecution = jobLauncher.run(job,
77-
new JobParameters(Collections.singletonMap("item.three", new JobParameter("error", String.class))));
77+
new JobParameters(Collections.singletonMap("item.three", new JobParameter<>("error", String.class))));
7878
assertEquals(BatchStatus.FAILED, jobExecution.getStatus());
7979
StepExecution stepExecution = jobExecution.getStepExecutions().iterator().next();
8080
assertEquals(9, stepExecution.getReadCount());

spring-batch-integration/src/test/java/org/springframework/batch/integration/chunk/RemoteChunkFaultTolerantStepJmsIntegrationTests.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2010-2022 the original author or authors.
2+
* Copyright 2010-2023 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.
@@ -53,7 +53,7 @@ static void clear() {
5353
@Test
5454
void testFailedStep() throws Exception {
5555
JobExecution jobExecution = jobLauncher.run(job, new JobParameters(
56-
Collections.singletonMap("item.three", new JobParameter("unsupported", String.class))));
56+
Collections.singletonMap("item.three", new JobParameter<>("unsupported", String.class))));
5757
assertEquals(BatchStatus.FAILED, jobExecution.getStatus());
5858
StepExecution stepExecution = jobExecution.getStepExecutions().iterator().next();
5959
assertEquals(9, stepExecution.getReadCount());
@@ -64,7 +64,7 @@ void testFailedStep() throws Exception {
6464
@Test
6565
void testFailedStepOnError() throws Exception {
6666
JobExecution jobExecution = jobLauncher.run(job,
67-
new JobParameters(Collections.singletonMap("item.three", new JobParameter("error", String.class))));
67+
new JobParameters(Collections.singletonMap("item.three", new JobParameter<>("error", String.class))));
6868
assertEquals(BatchStatus.FAILED, jobExecution.getStatus());
6969
StepExecution stepExecution = jobExecution.getStepExecutions().iterator().next();
7070
assertEquals(9, stepExecution.getReadCount());

spring-batch-integration/src/test/java/org/springframework/batch/integration/chunk/RemoteChunkStepIntegrationTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2009-2022 the original author or authors.
2+
* Copyright 2009-2023 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.
@@ -52,7 +52,7 @@ void testSunnyDaySimpleStep() throws Exception {
5252
@Test
5353
void testFailedStep() throws Exception {
5454
JobExecution jobExecution = jobLauncher.run(job,
55-
new JobParameters(Collections.singletonMap("item.three", new JobParameter("fail", String.class))));
55+
new JobParameters(Collections.singletonMap("item.three", new JobParameter<>("fail", String.class))));
5656
assertEquals(BatchStatus.FAILED, jobExecution.getStatus());
5757
StepExecution stepExecution = jobExecution.getStepExecutions().iterator().next();
5858
assertEquals(9, stepExecution.getReadCount());

spring-batch-test/src/main/java/org/springframework/batch/test/JobLauncherTestUtils.java

Lines changed: 2 additions & 2 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-2023 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.
@@ -152,7 +152,7 @@ public JobExecution launchJob(JobParameters jobParameters) throws Exception {
152152
*/
153153
public JobParameters getUniqueJobParameters() {
154154
Map<String, JobParameter<?>> parameters = new HashMap<>();
155-
parameters.put("random", new JobParameter(this.secureRandom.nextLong(), Long.class));
155+
parameters.put("random", new JobParameter<>(this.secureRandom.nextLong(), Long.class));
156156
return new JobParameters(parameters);
157157
}
158158

spring-batch-test/src/main/java/org/springframework/batch/test/JobRepositoryTestUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public class JobRepositoryTestUtils {
5050

5151
@Override
5252
public JobParameters getNext(@Nullable JobParameters parameters) {
53-
return new JobParameters(Collections.singletonMap("count", new JobParameter(count++, Long.class)));
53+
return new JobParameters(Collections.singletonMap("count", new JobParameter<>(count++, Long.class)));
5454
}
5555

5656
};

spring-batch-test/src/main/java/org/springframework/batch/test/StepRunner.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ private JobExecution launchJob(Job job, JobParameters jobParameters) {
178178
*/
179179
private JobParameters makeUniqueJobParameters() {
180180
Map<String, JobParameter<?>> parameters = new HashMap<>();
181-
parameters.put("timestamp", new JobParameter(new Date().getTime(), Long.class));
181+
parameters.put("timestamp", new JobParameter<>(new Date().getTime(), Long.class));
182182
return new JobParameters(parameters);
183183
}
184184

0 commit comments

Comments
 (0)