EMMA Coverage Report (generated Thu May 22 12:08:10 CDT 2014)
[all classes][org.springframework.batch.core.step.builder]

COVERAGE SUMMARY FOR SOURCE FILE [StepBuilder.java]

nameclass, %method, %block, %line, %
StepBuilder.java100% (1/1)88%  (7/8)87%  (47/54)89%  (8/9)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class StepBuilder100% (1/1)88%  (7/8)87%  (47/54)89%  (8/9)
chunk (CompletionPolicy): SimpleStepBuilder 0%   (0/1)0%   (0/7)0%   (0/1)
StepBuilder (String): void 100% (1/1)100% (4/4)100% (2/2)
chunk (int): SimpleStepBuilder 100% (1/1)100% (7/7)100% (1/1)
flow (Flow): FlowStepBuilder 100% (1/1)100% (7/7)100% (1/1)
job (Job): JobStepBuilder 100% (1/1)100% (7/7)100% (1/1)
partitioner (Step): PartitionStepBuilder 100% (1/1)100% (7/7)100% (1/1)
partitioner (String, Partitioner): PartitionStepBuilder 100% (1/1)100% (8/8)100% (1/1)
tasklet (Tasklet): TaskletStepBuilder 100% (1/1)100% (7/7)100% (1/1)

1/*
2 * Copyright 2006-2013 the original author or authors.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package org.springframework.batch.core.step.builder;
17 
18import org.springframework.batch.core.Job;
19import org.springframework.batch.core.Step;
20import org.springframework.batch.core.job.flow.Flow;
21import org.springframework.batch.core.partition.support.Partitioner;
22import org.springframework.batch.core.step.tasklet.Tasklet;
23import org.springframework.batch.repeat.CompletionPolicy;
24 
25/**
26 * Convenient entry point for building all kinds of steps. Use this as a factory for fluent builders of any step.
27 *
28 * @author Dave Syer
29 *
30 * @since 2.2
31 */
32public class StepBuilder extends StepBuilderHelper<StepBuilder> {
33 
34        /**
35         * Initialize a step builder for a step with the given name.
36         *
37         * @param name the name of the step
38         */
39        public StepBuilder(String name) {
40                super(name);
41        }
42 
43        /**
44         * Build a step with a custom tasklet, not necessarily item processing.
45         *
46         * @param tasklet a tasklet
47         * @return a {@link TaskletStepBuilder}
48         */
49        public TaskletStepBuilder tasklet(Tasklet tasklet) {
50                return new TaskletStepBuilder(this).tasklet(tasklet);
51        }
52 
53        /**
54         * Build a step that processes items in chunks with the size provided. To extend the step to being fault tolerant,
55         * call the {@link SimpleStepBuilder#faultTolerant()} method on the builder. In most cases you will want to
56         * parameterize your call to this method, to preserve the type safety of your readers and writers, e.g.
57         *
58         * <pre>
59         * new StepBuilder(&quot;step1&quot;).&lt;Order, Ledger&gt; chunk(100).reader(new OrderReader()).writer(new LedgerWriter())
60         * // ... etc.
61         * </pre>
62         *
63         * @param chunkSize the chunk size (commit interval)
64         * @return a {@link SimpleStepBuilder}
65         * @param <I> the type of item to be processed as input
66         * @param <O> the type of item to be output
67         */
68        public <I, O> SimpleStepBuilder<I, O> chunk(int chunkSize) {
69                return new SimpleStepBuilder<I, O>(this).chunk(chunkSize);
70        }
71 
72        /**
73         * Build a step that processes items in chunks with the completion policy provided. To extend the step to being
74         * fault tolerant, call the {@link SimpleStepBuilder#faultTolerant()} method on the builder. In most cases you will
75         * want to parameterize your call to this method, to preserve the type safety of your readers and writers, e.g.
76         *
77         * <pre>
78         * new StepBuilder(&quot;step1&quot;).&lt;Order, Ledger&gt; chunk(100).reader(new OrderReader()).writer(new LedgerWriter())
79         * // ... etc.
80         * </pre>
81         *
82         * @param completionPolicy the completion policy to use to control chunk processing
83         * @return a {@link SimpleStepBuilder}
84         * @param <I> the type of item to be processed as input
85         * @param <O> the type of item to be output *
86         */
87        public <I, O> SimpleStepBuilder<I, O> chunk(CompletionPolicy completionPolicy) {
88                return new SimpleStepBuilder<I, O>(this).chunk(completionPolicy);
89        }
90 
91        /**
92         * Create a partition step builder for a remote (or local) step.
93         *
94         * @param stepName the name of the remote or delegate step
95         * @param partitioner a partitioner to be used to construct new step executions
96         * @return a {@link PartitionStepBuilder}
97         */
98        public PartitionStepBuilder partitioner(String stepName, Partitioner partitioner) {
99                return new PartitionStepBuilder(this).partitioner(stepName, partitioner);
100        }
101 
102        /**
103         * Create a partition step builder for a remote (or local) step.
104         *
105         * @param step the step to execute in parallel
106         * @return a PartitionStepBuilder
107         */
108        public PartitionStepBuilder partitioner(Step step) {
109                return new PartitionStepBuilder(this).step(step);
110        }
111 
112        /**
113         * Create a new step builder that will execute a job.
114         *
115         * @param job a job to execute
116         * @return a {@link JobStepBuilder}
117         */
118        public JobStepBuilder job(Job job) {
119                return new JobStepBuilder(this).job(job);
120        }
121 
122        /**
123         * Create a new step builder that will execute a flow.
124         *
125         * @param flow a flow to execute
126         * @return a {@link FlowStepBuilder}
127         */
128        public FlowStepBuilder flow(Flow flow) {
129                return new FlowStepBuilder(this).flow(flow);
130        }
131 
132}

[all classes][org.springframework.batch.core.step.builder]
EMMA 2.0.5312 (C) Vladimir Roubtsov