BATCH-2080: Clean up "Invalid JavaBean property 'itemWriter' being accessed" warnings

Disambiguate tasklet/item(reader,processor,writer)/chunkCompletionPolicy properties in subclass
This commit is contained in:
Chris Schaefer
2014-02-18 23:01:44 -05:00
parent f87bf69dcf
commit 5bf53d6a93
3 changed files with 14 additions and 13 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2013 the original author or authors.
* Copyright 2013-2014 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.
@@ -44,7 +44,7 @@ public class BatchletParser extends AbstractSingleBeanDefinitionParser {
String taskletRef = batchletElement.getAttribute(REF);
if (StringUtils.hasText(taskletRef)) {
bd.getPropertyValues().addPropertyValue("tasklet", new RuntimeBeanReference(taskletRef));
bd.getPropertyValues().addPropertyValue("stepTasklet", new RuntimeBeanReference(taskletRef));
}
bd.setRole(BeanDefinition.ROLE_SUPPORT);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2013 the original author or authors.
* Copyright 2013-2014 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.
@@ -126,19 +126,19 @@ public class ChunkParser {
if(name.equals(READER_ELEMENT)) {
if (StringUtils.hasText(artifactName)) {
propertyValues.addPropertyValue("itemReader", new RuntimeBeanReference(artifactName));
propertyValues.addPropertyValue("stepItemReader", new RuntimeBeanReference(artifactName));
}
new PropertyParser(artifactName, parserContext, BatchArtifact.BatchArtifactType.STEP_ARTIFACT, stepName).parseProperties(nestedElement);
} else if(name.equals(PROCESSOR_ELEMENT)) {
if (StringUtils.hasText(artifactName)) {
propertyValues.addPropertyValue("itemProcessor", new RuntimeBeanReference(artifactName));
propertyValues.addPropertyValue("stepItemProcessor", new RuntimeBeanReference(artifactName));
}
new PropertyParser(artifactName, parserContext, BatchArtifact.BatchArtifactType.STEP_ARTIFACT, stepName).parseProperties(nestedElement);
} else if(name.equals(WRITER_ELEMENT)) {
if (StringUtils.hasText(artifactName)) {
propertyValues.addPropertyValue("itemWriter", new RuntimeBeanReference(artifactName));
propertyValues.addPropertyValue("stepItemWriter", new RuntimeBeanReference(artifactName));
}
new PropertyParser(artifactName, parserContext, BatchArtifact.BatchArtifactType.STEP_ARTIFACT, stepName).parseProperties(nestedElement);
@@ -174,7 +174,7 @@ public class ChunkParser {
String name = checkpointAlgorithmElement.getAttribute(REF_ATTRIBUTE);
if(StringUtils.hasText(name)) {
propertyValues.addPropertyValue("chunkCompletionPolicy", new RuntimeBeanReference(name));
propertyValues.addPropertyValue("stepChunkCompletionPolicy", new RuntimeBeanReference(name));
}
new PropertyParser(name, parserContext, BatchArtifact.BatchArtifactType.STEP_ARTIFACT, stepName).parseProperties(checkpointAlgorithmElement);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2013 the original author or authors.
* Copyright 2013-2014 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.
@@ -54,6 +54,7 @@ import org.springframework.util.Assert;
* configurable on the <step/>.
*
* @author Michael Minella
* @author Chris Schaefer
* @since 3.0
*/
@SuppressWarnings({"rawtypes", "unchecked"})
@@ -190,7 +191,7 @@ public class StepFactoryBean extends StepParserStepFactoryBean {
* @param tasklet {@link Tasklet} or {@link Batchlet} implementation
* @throws IllegalArgumentException if tasklet does not implement either Tasklet or Batchlet
*/
public void setTasklet(Object tasklet) {
public void setStepTasklet(Object tasklet) {
if(tasklet instanceof Tasklet) {
super.setTasklet((Tasklet) tasklet);
} else if(tasklet instanceof Batchlet){
@@ -208,7 +209,7 @@ public class StepFactoryBean extends StepParserStepFactoryBean {
* @param itemReader {@link ItemReader} or {@link org.springframework.batch.item.ItemReader} implementation
* @throws IllegalArgumentException if itemReader does not implement either version of ItemReader
*/
public void setItemReader(Object itemReader) {
public void setStepItemReader(Object itemReader) {
if(itemReader instanceof org.springframework.batch.item.ItemReader) {
super.setItemReader((org.springframework.batch.item.ItemReader) itemReader);
} else if(itemReader instanceof ItemReader){
@@ -226,7 +227,7 @@ public class StepFactoryBean extends StepParserStepFactoryBean {
* @param itemProcessor {@link ItemProcessor} or {@link org.springframework.batch.item.ItemProcessor} implementation
* @throws IllegalArgumentException if itemProcessor does not implement either version of ItemProcessor
*/
public void setItemProcessor(Object itemProcessor) {
public void setStepItemProcessor(Object itemProcessor) {
if(itemProcessor instanceof org.springframework.batch.item.ItemProcessor) {
super.setItemProcessor((org.springframework.batch.item.ItemProcessor) itemProcessor);
} else if(itemProcessor instanceof ItemProcessor){
@@ -244,7 +245,7 @@ public class StepFactoryBean extends StepParserStepFactoryBean {
* @param itemWriter {@link ItemWriter} or {@link org.springframework.batch.item.ItemWriter} implementation
* @throws IllegalArgumentException if itemWriter does not implement either version of ItemWriter
*/
public void setItemWriter(Object itemWriter) {
public void setStepItemWriter(Object itemWriter) {
if(itemWriter instanceof org.springframework.batch.item.ItemWriter) {
super.setItemWriter((org.springframework.batch.item.ItemWriter) itemWriter);
} else if(itemWriter instanceof ItemWriter){
@@ -262,7 +263,7 @@ public class StepFactoryBean extends StepParserStepFactoryBean {
* @param chunkCompletionPolicy {@link CompletionPolicy} or {@link CheckpointAlgorithm} implementation
* @throws IllegalArgumentException if chunkCompletionPolicy does not implement either CompletionPolicy or CheckpointAlgorithm
*/
public void setChunkCompletionPolicy(Object chunkCompletionPolicy) {
public void setStepChunkCompletionPolicy(Object chunkCompletionPolicy) {
if(chunkCompletionPolicy instanceof CompletionPolicy) {
super.setChunkCompletionPolicy((CompletionPolicy) chunkCompletionPolicy);
} else if(chunkCompletionPolicy instanceof CheckpointAlgorithm) {