From 7f4544f593802319d89b7af9f382473b504f48eb Mon Sep 17 00:00:00 2001 From: Dave Syer Date: Tue, 7 May 2013 16:33:39 +0100 Subject: [PATCH] BATCH-2024: extend javadocs to cover type parameters As described in the JIRA ticket, parameterized methods can be confusing for users, so it is good to include some hints how to use them in the javadocs. StepBuilder.chunk() is the focus here. --- | 1 + .../batch/core/step/builder/StepBuilder.java | 40 +++++++++++++------ 2 files changed, 29 insertions(+), 12 deletions(-) create mode 100644 diff --git a/ b/ new file mode 100644 index 000000000..ddeec4cd2 --- /dev/null +++ b/ @@ -0,0 +1 @@ +deb http://downloads.hipchat.com/linux/apt stable main diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/step/builder/StepBuilder.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/builder/StepBuilder.java index e0b08a461..d8a889c60 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/step/builder/StepBuilder.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/builder/StepBuilder.java @@ -24,16 +24,16 @@ import org.springframework.batch.repeat.CompletionPolicy; /** * Convenient entry point for building all kinds of steps. Use this as a factory for fluent builders of any step. - * + * * @author Dave Syer - * + * * @since 2.2 */ public class StepBuilder extends StepBuilderHelper { /** * Initialize a step builder for a step with the given name. - * + * * @param name the name of the step */ public StepBuilder(String name) { @@ -42,7 +42,7 @@ public class StepBuilder extends StepBuilderHelper { /** * Build a step with a custom tasklet, not necessarily item processing. - * + * * @param tasklet a tasklet * @return a {@link TaskletStepBuilder} */ @@ -52,10 +52,18 @@ public class StepBuilder extends StepBuilderHelper { /** * Build a step that processes items in chunks with the size provided. To extend the step to being fault tolerant, - * call the {@link SimpleStepBuilder#faultTolerant()} method on the builder. - * + * call the {@link SimpleStepBuilder#faultTolerant()} method on the builder. In most cases you will want to + * parameterize your call to this method, to preserve the type safety of your readers and writers, e.g. + * + *
+	 * new StepBuilder("step1").<Order, Ledger> chunk(100).reader(new OrderReader()).writer(new LedgerWriter())
+	 * // ... etc.
+	 * 
+ * * @param chunkSize the chunk size (commit interval) * @return a {@link SimpleStepBuilder} + * @param I the type of item to be processed as input + * @param O the type of item to be output */ public SimpleStepBuilder chunk(int chunkSize) { return new SimpleStepBuilder(this).chunk(chunkSize); @@ -63,10 +71,18 @@ public class StepBuilder extends StepBuilderHelper { /** * Build a step that processes items in chunks with the completion policy provided. To extend the step to being - * fault tolerant, call the {@link SimpleStepBuilder#faultTolerant()} method on the builder. - * + * fault tolerant, call the {@link SimpleStepBuilder#faultTolerant()} method on the builder. In most cases you will + * want to parameterize your call to this method, to preserve the type safety of your readers and writers, e.g. + * + *
+	 * new StepBuilder("step1").<Order, Ledger> chunk(100).reader(new OrderReader()).writer(new LedgerWriter())
+	 * // ... etc.
+	 * 
+ * * @param completionPolicy the completion policy to use to control chunk processing * @return a {@link SimpleStepBuilder} + * @param I the type of item to be processed as input + * @param O the type of item to be output * */ public SimpleStepBuilder chunk(CompletionPolicy completionPolicy) { return new SimpleStepBuilder(this).chunk(completionPolicy); @@ -74,7 +90,7 @@ public class StepBuilder extends StepBuilderHelper { /** * Create a partition step builder for a remote (or local) step. - * + * * @param stepName the name of the remote or delegate step * @param partitioner a partitioner to be used to construct new step executions * @return a {@link PartitionStepBuilder} @@ -85,7 +101,7 @@ public class StepBuilder extends StepBuilderHelper { /** * Create a partition step builder for a remote (or local) step. - * + * * @param step the step to execute in parallel * @return a PartitionStepBuilder */ @@ -95,7 +111,7 @@ public class StepBuilder extends StepBuilderHelper { /** * Create a new step builder that will execute a job. - * + * * @param job a job to execute * @return a {@link JobStepBuilder} */ @@ -105,7 +121,7 @@ public class StepBuilder extends StepBuilderHelper { /** * Create a new step builder that will execute a flow. - * + * * @param flow a flow to execute * @return a {@link FlowStepBuilder} */