public class StepContext extends SynchronizedAttributeAccessor
StepExecution and some of its associated properties using expressions
based on bean paths. Has public getters for the step execution and
convenience methods for accessing commonly used properties like the
ExecutionContext associated with the step or its enclosing job
execution.| Constructor and Description |
|---|
StepContext(StepExecution stepExecution)
Create a new instance of
StepContext for this
StepExecution. |
StepContext(StepExecution stepExecution,
BatchPropertyContext propertyContext) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Clean up the context at the end of a step execution.
|
boolean |
equals(java.lang.Object other)
Extend the base class method to include the step execution itself as a
key (i.e.
|
java.lang.String |
getId() |
java.util.Map<java.lang.String,java.lang.Object> |
getJobExecutionContext() |
java.lang.Long |
getJobInstanceId()
Convenient accessor for current
JobInstance identifier. |
java.lang.String |
getJobName()
Convenient accessor for current job name identifier.
|
java.util.Map<java.lang.String,java.lang.Object> |
getJobParameters() |
java.util.Map<java.lang.String,java.lang.Object> |
getPartitionPlan() |
StepExecution |
getStepExecution()
The current
StepExecution that is active in this context. |
java.util.Map<java.lang.String,java.lang.Object> |
getStepExecutionContext() |
java.lang.String |
getStepName()
Convenient accessor for current step name identifier.
|
java.util.Properties |
getSystemProperties()
Convenient accessor for System properties to make it easy to access them
from placeholder expressions.
|
int |
hashCode()
Overrides the default behaviour to provide a hash code based only on the
step execution.
|
void |
registerDestructionCallback(java.lang.String name,
java.lang.Runnable callback)
Allow clients to register callbacks for clean up on close.
|
java.lang.Object |
removeAttribute(java.lang.String name)
Override base class behaviour to ensure destruction callbacks are
unregistered as well as the default behaviour.
|
java.lang.String |
toString() |
attributeNames, getAttribute, hasAttribute, setAttribute, setAttributeIfAbsentpublic StepContext(StepExecution stepExecution)
StepContext for this
StepExecution.stepExecution - a step executionpublic StepContext(StepExecution stepExecution, BatchPropertyContext propertyContext)
public java.lang.String getStepName()
StepExecutionpublic java.lang.String getJobName()
JobInstance
associated with the current StepExecutionpublic java.lang.Long getJobInstanceId()
JobInstance identifier.JobInstance
associated with the current StepExecutionpublic java.util.Properties getSystemProperties()
public java.util.Map<java.lang.String,java.lang.Object> getStepExecutionContext()
ExecutionContextpublic java.util.Map<java.lang.String,java.lang.Object> getJobExecutionContext()
ExecutionContextpublic java.util.Map<java.lang.String,java.lang.Object> getJobParameters()
JobParameterspublic java.util.Map<java.lang.String,java.lang.Object> getPartitionPlan()
public void registerDestructionCallback(java.lang.String name,
java.lang.Runnable callback)
name - the callback id (unique attribute key in this context)callback - a callback to execute on close@Nullable public java.lang.Object removeAttribute(java.lang.String name)
removeAttribute in interface org.springframework.core.AttributeAccessorremoveAttribute in class SynchronizedAttributeAccessorSynchronizedAttributeAccessor.removeAttribute(String)public void close()
StepScope.public StepExecution getStepExecution()
StepExecution that is active in this context.StepExecutionpublic java.lang.String getId()
public boolean equals(java.lang.Object other)
equals in class SynchronizedAttributeAccessorSynchronizedAttributeAccessor.equals(Object)public int hashCode()
hashCode in class SynchronizedAttributeAccessorSynchronizedAttributeAccessor.hashCode()public java.lang.String toString()
toString in class SynchronizedAttributeAccessor