| 1 | /* |
| 2 | * Copyright 2006-2011 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 | */ |
| 16 | package org.springframework.batch.core.step.builder; |
| 17 | |
| 18 | import org.springframework.batch.core.step.tasklet.Tasklet; |
| 19 | |
| 20 | /** |
| 21 | * Builder for tasklet step based on a custom tasklet (not item oriented). |
| 22 | * |
| 23 | * @author Dave Syer |
| 24 | * |
| 25 | * @since 2.2 |
| 26 | */ |
| 27 | public class TaskletStepBuilder extends AbstractTaskletStepBuilder<TaskletStepBuilder> { |
| 28 | |
| 29 | private Tasklet tasklet; |
| 30 | |
| 31 | /** |
| 32 | * Create a new builder initialized with any properties in the parent. The parent is copied, so it can be re-used. |
| 33 | * |
| 34 | * @param parent a parent helper containing common step properties |
| 35 | */ |
| 36 | public TaskletStepBuilder(StepBuilderHelper<?> parent) { |
| 37 | super(parent); |
| 38 | } |
| 39 | |
| 40 | /** |
| 41 | * @param tasklet tehe tasklet to use |
| 42 | * @return this for fluent chaining |
| 43 | */ |
| 44 | public TaskletStepBuilder tasklet(Tasklet tasklet) { |
| 45 | this.tasklet = tasklet; |
| 46 | return this; |
| 47 | } |
| 48 | |
| 49 | @Override |
| 50 | protected Tasklet createTasklet() { |
| 51 | return tasklet; |
| 52 | } |
| 53 | |
| 54 | } |