org.springframework.batch.core.step.tasklet
Class TaskletAdapter

java.lang.Object
  extended by org.springframework.batch.item.adapter.AbstractMethodInvokingDelegator
      extended by org.springframework.batch.core.step.tasklet.TaskletAdapter
All Implemented Interfaces:
Tasklet, InitializingBean

public class TaskletAdapter
extends AbstractMethodInvokingDelegator
implements Tasklet

A Tasklet that wraps a method in a POJO. By default the return value is ExitStatus.FINISHED unless the delegate POJO itself returns an ExitStatus. The POJO method is usually going to have no arguments, but a static argument or array of arguments can be used by setting the arguments property.

Author:
Dave Syer
See Also:
AbstractMethodInvokingDelegator

Constructor Summary
TaskletAdapter()
           
 
Method Summary
 ExitStatus execute()
          Delegate execution to the target object and translate the return value to an ExitStatus by invoking a method in the delegate POJO.
protected  ExitStatus mapResult(Object result)
          If the result is an ExitStatus already just return that, otherwise return ExitStatus.FINISHED.
 
Methods inherited from class org.springframework.batch.item.adapter.AbstractMethodInvokingDelegator
afterPropertiesSet, invokeDelegateMethod, invokeDelegateMethodWithArgument, invokeDelegateMethodWithArguments, setArguments, setTargetMethod, setTargetObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TaskletAdapter

public TaskletAdapter()
Method Detail

execute

public ExitStatus execute()
                   throws Exception
Delegate execution to the target object and translate the return value to an ExitStatus by invoking a method in the delegate POJO.

Specified by:
execute in interface Tasklet
Returns:
ExitStatus indicating success or failure
Throws:
Exception
See Also:
Tasklet.execute()

mapResult

protected ExitStatus mapResult(Object result)
If the result is an ExitStatus already just return that, otherwise return ExitStatus.FINISHED.

Parameters:
result - the value returned by the delegate method
Returns:
an ExitStatus consistent with the result


Copyright © 2008 SpringSource. All Rights Reserved.