public class MethodInvokingTaskletAdapter extends AbstractMethodInvokingDelegator<java.lang.Object> implements Tasklet
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.AbstractMethodInvokingDelegator
AbstractMethodInvokingDelegator.InvocationTargetThrowableWrapper
Constructor and Description |
---|
MethodInvokingTaskletAdapter() |
Modifier and Type | Method and Description |
---|---|
RepeatStatus |
execute(StepContribution contribution,
ChunkContext chunkContext)
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(java.lang.Object result)
If the result is an
ExitStatus already just return that,
otherwise return ExitStatus.COMPLETED . |
afterPropertiesSet, getArguments, invokeDelegateMethod, invokeDelegateMethodWithArgument, invokeDelegateMethodWithArguments, setArguments, setTargetMethod, setTargetObject
@Nullable public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) throws java.lang.Exception
ExitStatus
by invoking a method in the delegate POJO. Ignores
the StepContribution
and the attributes.execute
in interface Tasklet
contribution
- mutable state to be passed back to update the current
step executionchunkContext
- attributes shared between invocations but not between
restartsRepeatStatus
indicating whether processing is
continuable. Returning null
is interpreted as RepeatStatus.FINISHED
java.lang.Exception
- thrown if error occurs during execution.Tasklet.execute(StepContribution, ChunkContext)
protected ExitStatus mapResult(java.lang.Object result)
ExitStatus
already just return that,
otherwise return ExitStatus.COMPLETED
.result
- the value returned by the delegate methodExitStatus
consistent with the result