org.springframework.batch.core.step.tasklet
Class MethodInvokingTaskletAdapter
java.lang.Object
org.springframework.batch.item.adapter.AbstractMethodInvokingDelegator<Object>
org.springframework.batch.core.step.tasklet.MethodInvokingTaskletAdapter
- All Implemented Interfaces:
- Tasklet, InitializingBean
public class MethodInvokingTaskletAdapter
- extends AbstractMethodInvokingDelegator<Object>
- implements Tasklet
A Tasklet
that wraps a method in a POJO. By default the return
value is ExitStatus.COMPLETED
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
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
MethodInvokingTaskletAdapter
public MethodInvokingTaskletAdapter()
execute
public RepeatStatus execute(StepContribution contribution,
ChunkContext chunkContext)
throws Exception
- Delegate execution to the target object and translate the return value to
an
ExitStatus
by invoking a method in the delegate POJO. Ignores
the StepContribution
and the attributes.
- Specified by:
execute
in interface Tasklet
- Parameters:
contribution
- mutable state to be passed back to update the current
step executionchunkContext
- attributes shared between invocations but not between
restarts
- Returns:
- an
RepeatStatus
indicating whether processing is
continuable.
- Throws:
Exception
- See Also:
Tasklet.execute(StepContribution, ChunkContext)
mapResult
protected ExitStatus mapResult(Object result)
- If the result is an
ExitStatus
already just return that,
otherwise return ExitStatus.COMPLETED
.
- Parameters:
result
- the value returned by the delegate method
- Returns:
- an
ExitStatus
consistent with the result
Copyright © 2013 SpringSource. All Rights Reserved.