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 java.lang.Object
      implements Tasklet, org.springframework.beans.factory.InitializingBean

  Adapts a `Callable`<`RepeatStatus`> to the `Tasklet` interface.
  Author:
    Dave Syer

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `CallableTaskletAdapter()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and 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(java.util.concurrent.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 Detail

    - #### CallableTaskletAdapter

          public CallableTaskletAdapter()

  - ### Method Detail

    - #### setCallable

          public void setCallable(java.util.concurrent.Callable<RepeatStatus> callable)

      Public setter for the `Callable`.
      Parameters:
        `callable` - the `Callable` to set

    - #### afterPropertiesSet

          public void afterPropertiesSet()
                                  throws java.lang.Exception

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

    - #### execute

          @Nullable
          public RepeatStatus execute(StepContribution contribution,
                                                ChunkContext chunkContext)
                                         throws java.lang.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:
        `java.lang.Exception` - thrown if error occurs during execution.
      See Also:
        `Tasklet.execute(StepContribution, ChunkContext)`