public class MethodInvokingTaskletAdapter extends AbstractMethodInvokingDelegator<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(Object result)
If the result is an
ExitStatus already just return that,
otherwise return ExitStatus.COMPLETED . |
afterPropertiesSet, invokeDelegateMethod, invokeDelegateMethodWithArgument, invokeDelegateMethodWithArguments, setArguments, setTargetMethod, setTargetObject
public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) throws 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.Exception
Tasklet.execute(StepContribution, ChunkContext)
protected ExitStatus mapResult(Object result)
ExitStatus
already just return that,
otherwise return ExitStatus.COMPLETED
.result
- the value returned by the delegate methodExitStatus
consistent with the resultCopyright © 2014 Pivotal. All rights reserved.