Remove usage of raw parametrized types
This commit is contained in:
@@ -105,7 +105,7 @@ public class JobParametersBuilder {
|
||||
* @return a reference to this object.
|
||||
*/
|
||||
public JobParametersBuilder addString(String key, @NonNull String parameter, boolean identifying) {
|
||||
this.parameterMap.put(key, new JobParameter(parameter, String.class, identifying));
|
||||
this.parameterMap.put(key, new JobParameter<>(parameter, String.class, identifying));
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@ public class JobParametersBuilder {
|
||||
* @return a reference to this object.
|
||||
*/
|
||||
public JobParametersBuilder addDate(String key, @NonNull Date parameter, boolean identifying) {
|
||||
this.parameterMap.put(key, new JobParameter(parameter, Date.class, identifying));
|
||||
this.parameterMap.put(key, new JobParameter<>(parameter, Date.class, identifying));
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -151,7 +151,7 @@ public class JobParametersBuilder {
|
||||
* @return a reference to this object.
|
||||
*/
|
||||
public JobParametersBuilder addLocalDate(String key, @NonNull LocalDate parameter, boolean identifying) {
|
||||
this.parameterMap.put(key, new JobParameter(parameter, LocalDate.class, identifying));
|
||||
this.parameterMap.put(key, new JobParameter<>(parameter, LocalDate.class, identifying));
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -174,7 +174,7 @@ public class JobParametersBuilder {
|
||||
* @return a reference to this object.
|
||||
*/
|
||||
public JobParametersBuilder addLocalTime(String key, @NonNull LocalTime parameter, boolean identifying) {
|
||||
this.parameterMap.put(key, new JobParameter(parameter, LocalTime.class, identifying));
|
||||
this.parameterMap.put(key, new JobParameter<>(parameter, LocalTime.class, identifying));
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -197,7 +197,7 @@ public class JobParametersBuilder {
|
||||
* @return a reference to this object.
|
||||
*/
|
||||
public JobParametersBuilder addLocalDateTime(String key, @NonNull LocalDateTime parameter, boolean identifying) {
|
||||
this.parameterMap.put(key, new JobParameter(parameter, LocalDateTime.class, identifying));
|
||||
this.parameterMap.put(key, new JobParameter<>(parameter, LocalDateTime.class, identifying));
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -220,7 +220,7 @@ public class JobParametersBuilder {
|
||||
* @return a reference to this object.
|
||||
*/
|
||||
public JobParametersBuilder addLong(String key, @NonNull Long parameter, boolean identifying) {
|
||||
this.parameterMap.put(key, new JobParameter(parameter, Long.class, identifying));
|
||||
this.parameterMap.put(key, new JobParameter<>(parameter, Long.class, identifying));
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -243,7 +243,7 @@ public class JobParametersBuilder {
|
||||
* @return a reference to this object.
|
||||
*/
|
||||
public JobParametersBuilder addDouble(String key, @NonNull Double parameter, boolean identifying) {
|
||||
this.parameterMap.put(key, new JobParameter(parameter, Double.class, identifying));
|
||||
this.parameterMap.put(key, new JobParameter<>(parameter, Double.class, identifying));
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -293,7 +293,7 @@ public class JobParametersBuilder {
|
||||
* @since 5.0
|
||||
*/
|
||||
public <T> JobParametersBuilder addJobParameter(String name, T value, Class<T> type, boolean identifying) {
|
||||
return addJobParameter(name, new JobParameter(value, type, identifying));
|
||||
return addJobParameter(name, new JobParameter<>(value, type, identifying));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -54,14 +54,14 @@ class JobParametersTests {
|
||||
private JobParameters getNewParameters() {
|
||||
|
||||
Map<String, JobParameter<?>> parameterMap = new HashMap<>();
|
||||
parameterMap.put("string.key1", new JobParameter("value1", String.class, true));
|
||||
parameterMap.put("string.key2", new JobParameter("value2", String.class, true));
|
||||
parameterMap.put("long.key1", new JobParameter(1L, Long.class, true));
|
||||
parameterMap.put("long.key2", new JobParameter(2L, Long.class, true));
|
||||
parameterMap.put("double.key1", new JobParameter(1.1, Double.class, true));
|
||||
parameterMap.put("double.key2", new JobParameter(2.2, Double.class, true));
|
||||
parameterMap.put("date.key1", new JobParameter(date1, Date.class, true));
|
||||
parameterMap.put("date.key2", new JobParameter(date2, Date.class, true));
|
||||
parameterMap.put("string.key1", new JobParameter<>("value1", String.class, true));
|
||||
parameterMap.put("string.key2", new JobParameter<>("value2", String.class, true));
|
||||
parameterMap.put("long.key1", new JobParameter<>(1L, Long.class, true));
|
||||
parameterMap.put("long.key2", new JobParameter<>(2L, Long.class, true));
|
||||
parameterMap.put("double.key1", new JobParameter<>(1.1, Double.class, true));
|
||||
parameterMap.put("double.key2", new JobParameter<>(2.2, Double.class, true));
|
||||
parameterMap.put("date.key1", new JobParameter<>(date1, Date.class, true));
|
||||
parameterMap.put("date.key2", new JobParameter<>(date2, Date.class, true));
|
||||
|
||||
return new JobParameters(parameterMap);
|
||||
}
|
||||
@@ -148,14 +148,14 @@ class JobParametersTests {
|
||||
String string1 = stringBuilder.toString();
|
||||
|
||||
Map<String, JobParameter<?>> parameterMap = new HashMap<>();
|
||||
parameterMap.put("string.key2", new JobParameter("value2", String.class, true));
|
||||
parameterMap.put("string.key1", new JobParameter("value1", String.class, true));
|
||||
parameterMap.put("long.key2", new JobParameter(2L, Long.class, true));
|
||||
parameterMap.put("long.key1", new JobParameter(1L, Long.class, true));
|
||||
parameterMap.put("double.key2", new JobParameter(2.2, Double.class, true));
|
||||
parameterMap.put("double.key1", new JobParameter(1.1, Double.class, true));
|
||||
parameterMap.put("date.key2", new JobParameter(date2, Date.class, true));
|
||||
parameterMap.put("date.key1", new JobParameter(date1, Date.class, true));
|
||||
parameterMap.put("string.key2", new JobParameter<>("value2", String.class, true));
|
||||
parameterMap.put("string.key1", new JobParameter<>("value1", String.class, true));
|
||||
parameterMap.put("long.key2", new JobParameter<>(2L, Long.class, true));
|
||||
parameterMap.put("long.key1", new JobParameter<>(1L, Long.class, true));
|
||||
parameterMap.put("double.key2", new JobParameter<>(2.2, Double.class, true));
|
||||
parameterMap.put("double.key1", new JobParameter<>(1.1, Double.class, true));
|
||||
parameterMap.put("date.key2", new JobParameter<>(date2, Date.class, true));
|
||||
parameterMap.put("date.key1", new JobParameter<>(date1, Date.class, true));
|
||||
|
||||
JobParameters testProps = new JobParameters(parameterMap);
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ public abstract class AbstractExecutionContextSerializerTests {
|
||||
@Test
|
||||
void testSerializeStringJobParameter() throws Exception {
|
||||
Map<String, Object> m1 = new HashMap<>();
|
||||
m1.put("name", new JobParameter("foo", String.class));
|
||||
m1.put("name", new JobParameter<>("foo", String.class));
|
||||
|
||||
Map<String, Object> m2 = serializationRoundTrip(m1);
|
||||
|
||||
@@ -75,7 +75,7 @@ public abstract class AbstractExecutionContextSerializerTests {
|
||||
@Test
|
||||
void testSerializeDateJobParameter() throws Exception {
|
||||
Map<String, Object> m1 = new HashMap<>();
|
||||
m1.put("birthDate", new JobParameter(new Date(123456790123L), Date.class));
|
||||
m1.put("birthDate", new JobParameter<>(new Date(123456790123L), Date.class));
|
||||
|
||||
Map<String, Object> m2 = serializationRoundTrip(m1);
|
||||
|
||||
@@ -85,7 +85,7 @@ public abstract class AbstractExecutionContextSerializerTests {
|
||||
@Test
|
||||
void testSerializeDoubleJobParameter() throws Exception {
|
||||
Map<String, Object> m1 = new HashMap<>();
|
||||
m1.put("weight", new JobParameter(80.5D, Double.class));
|
||||
m1.put("weight", new JobParameter<>(80.5D, Double.class));
|
||||
|
||||
Map<String, Object> m2 = serializationRoundTrip(m1);
|
||||
|
||||
@@ -95,7 +95,7 @@ public abstract class AbstractExecutionContextSerializerTests {
|
||||
@Test
|
||||
void testSerializeLongJobParameter() throws Exception {
|
||||
Map<String, Object> m1 = new HashMap<>();
|
||||
m1.put("age", new JobParameter(20L, Long.class));
|
||||
m1.put("age", new JobParameter<>(20L, Long.class));
|
||||
|
||||
Map<String, Object> m2 = serializationRoundTrip(m1);
|
||||
|
||||
@@ -105,7 +105,7 @@ public abstract class AbstractExecutionContextSerializerTests {
|
||||
@Test
|
||||
void testSerializeNonIdentifyingJobParameter() throws Exception {
|
||||
Map<String, Object> m1 = new HashMap<>();
|
||||
m1.put("name", new JobParameter("foo", String.class, false));
|
||||
m1.put("name", new JobParameter<>("foo", String.class, false));
|
||||
|
||||
Map<String, Object> m2 = serializationRoundTrip(m1);
|
||||
|
||||
@@ -115,7 +115,7 @@ public abstract class AbstractExecutionContextSerializerTests {
|
||||
@Test
|
||||
void testSerializeJobParameters() throws Exception {
|
||||
Map<String, JobParameter<?>> jobParametersMap = new HashMap<>();
|
||||
jobParametersMap.put("paramName", new JobParameter("paramValue", String.class));
|
||||
jobParametersMap.put("paramName", new JobParameter<>("paramValue", String.class));
|
||||
|
||||
Map<String, Object> m1 = new HashMap<>();
|
||||
m1.put("params", new JobParameters(jobParametersMap));
|
||||
|
||||
@@ -96,7 +96,7 @@ public class JdbcJobExecutionDaoTests extends AbstractJobExecutionDaoTests {
|
||||
void testDeleteJobExecutionParameters() {
|
||||
// given
|
||||
Map<String, JobParameter<?>> parameters = new HashMap<>();
|
||||
parameters.put("string-param", new JobParameter("value", String.class));
|
||||
parameters.put("string-param", new JobParameter<>("value", String.class));
|
||||
JobExecution execution = new JobExecution(jobInstance, new JobParameters(parameters));
|
||||
dao.saveJobExecution(execution);
|
||||
|
||||
|
||||
@@ -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.
|
||||
@@ -36,7 +36,7 @@ import org.springframework.batch.core.JobParameters;
|
||||
class ChunkContextTests {
|
||||
|
||||
private final ChunkContext context = new ChunkContext(new StepContext(new JobExecution(new JobInstance(0L, "job"),
|
||||
1L, new JobParameters(Collections.singletonMap("foo", new JobParameter("bar", String.class))))
|
||||
1L, new JobParameters(Collections.singletonMap("foo", new JobParameter<>("bar", String.class))))
|
||||
.createStepExecution("foo")));
|
||||
|
||||
@Test
|
||||
|
||||
@@ -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.
|
||||
@@ -91,7 +91,7 @@ public abstract class AvroTestFixtures {
|
||||
}
|
||||
|
||||
protected Chunk<GenericRecord> genericAvroGeneratedUsers() {
|
||||
return new Chunk(this.avroGeneratedUsers.getItems().stream().map(u -> {
|
||||
return new Chunk<>(this.avroGeneratedUsers.getItems().stream().map(u -> {
|
||||
GenericData.Record avroRecord;
|
||||
avroRecord = new GenericData.Record(u.getSchema());
|
||||
avroRecord.put("name", u.getName());
|
||||
@@ -106,7 +106,7 @@ public abstract class AvroTestFixtures {
|
||||
}
|
||||
|
||||
protected Chunk<GenericRecord> genericPlainOldUsers() {
|
||||
return new Chunk(
|
||||
return new Chunk<>(
|
||||
this.plainOldUsers.getItems().stream().map(PlainOldUser::toGenericRecord).collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ class RemoteChunkFaultTolerantStepIntegrationTests {
|
||||
@Test
|
||||
void testFailedStep() throws Exception {
|
||||
JobExecution jobExecution = jobLauncher.run(job, new JobParameters(
|
||||
Collections.singletonMap("item.three", new JobParameter("unsupported", String.class))));
|
||||
Collections.singletonMap("item.three", new JobParameter<>("unsupported", String.class))));
|
||||
assertEquals(BatchStatus.FAILED, jobExecution.getStatus());
|
||||
StepExecution stepExecution = jobExecution.getStepExecutions().iterator().next();
|
||||
assertEquals(9, stepExecution.getReadCount());
|
||||
@@ -68,7 +68,7 @@ class RemoteChunkFaultTolerantStepIntegrationTests {
|
||||
@Test
|
||||
void testFailedStepOnError() throws Exception {
|
||||
JobExecution jobExecution = jobLauncher.run(job,
|
||||
new JobParameters(Collections.singletonMap("item.three", new JobParameter("error", String.class))));
|
||||
new JobParameters(Collections.singletonMap("item.three", new JobParameter<>("error", String.class))));
|
||||
assertEquals(BatchStatus.FAILED, jobExecution.getStatus());
|
||||
StepExecution stepExecution = jobExecution.getStepExecutions().iterator().next();
|
||||
assertEquals(9, stepExecution.getReadCount());
|
||||
|
||||
@@ -62,7 +62,7 @@ class RemoteChunkFaultTolerantStepJdbcIntegrationTests {
|
||||
@DirtiesContext
|
||||
void testFailedStep() throws Exception {
|
||||
JobExecution jobExecution = jobLauncher.run(job, new JobParameters(
|
||||
Collections.singletonMap("item.three", new JobParameter("unsupported", String.class))));
|
||||
Collections.singletonMap("item.three", new JobParameter<>("unsupported", String.class))));
|
||||
assertEquals(BatchStatus.FAILED, jobExecution.getStatus());
|
||||
StepExecution stepExecution = jobExecution.getStepExecutions().iterator().next();
|
||||
assertEquals(9, stepExecution.getReadCount());
|
||||
@@ -74,7 +74,7 @@ class RemoteChunkFaultTolerantStepJdbcIntegrationTests {
|
||||
@DirtiesContext
|
||||
void testFailedStepOnError() throws Exception {
|
||||
JobExecution jobExecution = jobLauncher.run(job,
|
||||
new JobParameters(Collections.singletonMap("item.three", new JobParameter("error", String.class))));
|
||||
new JobParameters(Collections.singletonMap("item.three", new JobParameter<>("error", String.class))));
|
||||
assertEquals(BatchStatus.FAILED, jobExecution.getStatus());
|
||||
StepExecution stepExecution = jobExecution.getStepExecutions().iterator().next();
|
||||
assertEquals(9, stepExecution.getReadCount());
|
||||
|
||||
@@ -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.
|
||||
@@ -53,7 +53,7 @@ class RemoteChunkFaultTolerantStepJmsIntegrationTests {
|
||||
@Test
|
||||
void testFailedStep() throws Exception {
|
||||
JobExecution jobExecution = jobLauncher.run(job, new JobParameters(
|
||||
Collections.singletonMap("item.three", new JobParameter("unsupported", String.class))));
|
||||
Collections.singletonMap("item.three", new JobParameter<>("unsupported", String.class))));
|
||||
assertEquals(BatchStatus.FAILED, jobExecution.getStatus());
|
||||
StepExecution stepExecution = jobExecution.getStepExecutions().iterator().next();
|
||||
assertEquals(9, stepExecution.getReadCount());
|
||||
@@ -64,7 +64,7 @@ class RemoteChunkFaultTolerantStepJmsIntegrationTests {
|
||||
@Test
|
||||
void testFailedStepOnError() throws Exception {
|
||||
JobExecution jobExecution = jobLauncher.run(job,
|
||||
new JobParameters(Collections.singletonMap("item.three", new JobParameter("error", String.class))));
|
||||
new JobParameters(Collections.singletonMap("item.three", new JobParameter<>("error", String.class))));
|
||||
assertEquals(BatchStatus.FAILED, jobExecution.getStatus());
|
||||
StepExecution stepExecution = jobExecution.getStepExecutions().iterator().next();
|
||||
assertEquals(9, stepExecution.getReadCount());
|
||||
|
||||
@@ -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.
|
||||
@@ -52,7 +52,7 @@ class RemoteChunkStepIntegrationTests {
|
||||
@Test
|
||||
void testFailedStep() throws Exception {
|
||||
JobExecution jobExecution = jobLauncher.run(job,
|
||||
new JobParameters(Collections.singletonMap("item.three", new JobParameter("fail", String.class))));
|
||||
new JobParameters(Collections.singletonMap("item.three", new JobParameter<>("fail", String.class))));
|
||||
assertEquals(BatchStatus.FAILED, jobExecution.getStatus());
|
||||
StepExecution stepExecution = jobExecution.getStepExecutions().iterator().next();
|
||||
assertEquals(9, stepExecution.getReadCount());
|
||||
|
||||
@@ -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.
|
||||
@@ -152,7 +152,7 @@ public class JobLauncherTestUtils {
|
||||
*/
|
||||
public JobParameters getUniqueJobParameters() {
|
||||
Map<String, JobParameter<?>> parameters = new HashMap<>();
|
||||
parameters.put("random", new JobParameter(this.secureRandom.nextLong(), Long.class));
|
||||
parameters.put("random", new JobParameter<>(this.secureRandom.nextLong(), Long.class));
|
||||
return new JobParameters(parameters);
|
||||
}
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ public class JobRepositoryTestUtils {
|
||||
|
||||
@Override
|
||||
public JobParameters getNext(@Nullable JobParameters parameters) {
|
||||
return new JobParameters(Collections.singletonMap("count", new JobParameter(count++, Long.class)));
|
||||
return new JobParameters(Collections.singletonMap("count", new JobParameter<>(count++, Long.class)));
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
@@ -178,7 +178,7 @@ public class StepRunner {
|
||||
*/
|
||||
private JobParameters makeUniqueJobParameters() {
|
||||
Map<String, JobParameter<?>> parameters = new HashMap<>();
|
||||
parameters.put("timestamp", new JobParameter(new Date().getTime(), Long.class));
|
||||
parameters.put("timestamp", new JobParameter<>(new Date().getTime(), Long.class));
|
||||
return new JobParameters(parameters);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user