001/* 002 * Copyright 2006-2011 the original author or authors. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * https://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package org.springframework.batch.core.step.builder; 017 018import org.springframework.batch.core.step.tasklet.Tasklet; 019 020/** 021 * Builder for tasklet step based on a custom tasklet (not item oriented). 022 * 023 * @author Dave Syer 024 * 025 * @since 2.2 026 */ 027public class TaskletStepBuilder extends AbstractTaskletStepBuilder<TaskletStepBuilder> { 028 029 private Tasklet tasklet; 030 031 /** 032 * Create a new builder initialized with any properties in the parent. The parent is copied, so it can be re-used. 033 * 034 * @param parent a parent helper containing common step properties 035 */ 036 public TaskletStepBuilder(StepBuilderHelper<?> parent) { 037 super(parent); 038 } 039 040 /** 041 * @param tasklet the tasklet to use 042 * @return this for fluent chaining 043 */ 044 public TaskletStepBuilder tasklet(Tasklet tasklet) { 045 this.tasklet = tasklet; 046 return this; 047 } 048 049 @Override 050 protected Tasklet createTasklet() { 051 return tasklet; 052 } 053 054}