Package org.springframework.batch.core.step.tasklet

# Class CallableTaskletAdapter

java.lang.Object
org.springframework.batch.core.step.tasklet.CallableTaskletAdapter

All Implemented Interfaces:
  `Tasklet`, `org.springframework.beans.factory.InitializingBean`

public class CallableTaskletAdapter extends Object implements Tasklet, org.springframework.beans.factory.InitializingBean
Adapts a `Callable`<`RepeatStatus`> to the `Tasklet` interface.

Author:
  Dave Syer

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `CallableTaskletAdapter()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `afterPropertiesSet()`
  Assert that the callable is set.
  `RepeatStatus`
  `execute(StepContribution contribution, ChunkContext chunkContext)`
  Execute the provided Callable and return its `RepeatStatus`.
  `void`
  `setCallable(Callable<RepeatStatus> callable)`
  Public setter for the `Callable`.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### CallableTaskletAdapter

    public CallableTaskletAdapter()

- ## Method Details

  - ### setCallable

    public void setCallable(Callable<RepeatStatus> callable)
    Public setter for the `Callable`.
    Parameters:
      `callable` - the `Callable` to set

  - ### afterPropertiesSet

    public void afterPropertiesSet() throws Exception
    Assert that the callable is set.
    Specified by:
      `afterPropertiesSet` in interface `org.springframework.beans.factory.InitializingBean`
    Throws:
      `Exception`
    See Also:
      - `InitializingBean.afterPropertiesSet()`

  - ### execute

    @Nullable public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) throws Exception
    Execute the provided Callable and return its `RepeatStatus`. 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 execution
      `chunkContext` - attributes shared between invocations but not between restarts
    Returns:
      an `RepeatStatus` indicating whether processing is continuable. Returning `null` is interpreted as `RepeatStatus.FINISHED`
    Throws:
      `Exception` - thrown if error occurs during execution.
    See Also:
      - `Tasklet.execute(StepContribution, ChunkContext)`