org.springframework.batch.core.jsr

## Class JsrStepContext

- java.lang.Object
- - org.springframework.batch.core.jsr.JsrStepContext

- All Implemented Interfaces:
    javax.batch.runtime.context.StepContext

      public class JsrStepContext
      extends java.lang.Object
      implements javax.batch.runtime.context.StepContext

  Wrapper class to provide the `StepContext` functionality as specified in JSR-352. Wrapper delegates to the underlying `StepExecution` to obtain the related contextual information.
  Since:
    3.0
  Author:
    Michael Minella, Chris Schaefer

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `JsrStepContext(StepExecution stepExecution, java.util.Properties properties)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `javax.batch.runtime.BatchStatus` | `getBatchStatus()`
    `java.lang.Exception` | `getException()` To support both JSR-352's requirement to return the most recent exception and Spring Batch's support for `Throwable`, this implementation will return the most recent exception in the underlying `StepExecution`'s failure exceptions list.
    `java.lang.String` | `getExitStatus()`
    `javax.batch.runtime.Metric[]` | `getMetrics()`
    `java.io.Serializable` | `getPersistentUserData()`
    `java.util.Properties` | `getProperties()`
    `long` | `getStepExecutionId()`
    `java.lang.String` | `getStepName()`
    `java.lang.Object` | `getTransientUserData()`
    `void` | `setExitStatus(java.lang.String status)`
    `void` | `setPersistentUserData(java.io.Serializable data)`
    `void` | `setTransientUserData(java.lang.Object data)`

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

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

- - ### Constructor Detail

    - #### JsrStepContext

          public JsrStepContext(StepExecution stepExecution,
                                java.util.Properties properties)

  - ### Method Detail

    - #### getStepName

          public java.lang.String getStepName()

      Specified by:
        `getStepName` in interface `javax.batch.runtime.context.StepContext`

    - #### getTransientUserData

          public java.lang.Object getTransientUserData()

      Specified by:
        `getTransientUserData` in interface `javax.batch.runtime.context.StepContext`

    - #### setTransientUserData

          public void setTransientUserData(java.lang.Object data)

      Specified by:
        `setTransientUserData` in interface `javax.batch.runtime.context.StepContext`

    - #### getStepExecutionId

          public long getStepExecutionId()

      Specified by:
        `getStepExecutionId` in interface `javax.batch.runtime.context.StepContext`

    - #### getProperties

          public java.util.Properties getProperties()

      Specified by:
        `getProperties` in interface `javax.batch.runtime.context.StepContext`

    - #### getPersistentUserData

          public java.io.Serializable getPersistentUserData()

      Specified by:
        `getPersistentUserData` in interface `javax.batch.runtime.context.StepContext`

    - #### setPersistentUserData

          public void setPersistentUserData(java.io.Serializable data)

      Specified by:
        `setPersistentUserData` in interface `javax.batch.runtime.context.StepContext`

    - #### getBatchStatus

          public javax.batch.runtime.BatchStatus getBatchStatus()

      Specified by:
        `getBatchStatus` in interface `javax.batch.runtime.context.StepContext`

    - #### getExitStatus

          public java.lang.String getExitStatus()

      Specified by:
        `getExitStatus` in interface `javax.batch.runtime.context.StepContext`

    - #### setExitStatus

          public void setExitStatus(java.lang.String status)

      Specified by:
        `setExitStatus` in interface `javax.batch.runtime.context.StepContext`

    - #### getException

          public java.lang.Exception getException()

      To support both JSR-352's requirement to return the most recent exception and Spring Batch's support for `Throwable`, this implementation will return the most recent exception in the underlying `StepExecution`'s failure exceptions list. If the exception there extends `Throwable` instead of `Exception`, it will be wrapped in an `Exception` and then returned.
      Specified by:
        `getException` in interface `javax.batch.runtime.context.StepContext`
      See Also:
        `StepContext.getException()`

    - #### getMetrics

          public javax.batch.runtime.Metric[] getMetrics()

      Specified by:
        `getMetrics` in interface `javax.batch.runtime.context.StepContext`