类 StepContext
- java.lang.Object
- org.springframework.batch.repeat.context.SynchronizedAttributeAccessor
- org.springframework.batch.core.scope.context.StepContext
- 所有已实现的接口:
org.springframework.core.AttributeAccessor
public class StepContext extends SynchronizedAttributeAccessor
A context object that can be used to interrogate the currentStepExecution
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 theExecutionContext
associated with the step or its enclosing job execution.- 作者:
- Dave Syer, Michael Minella, Mahmoud Ben Hassine
构造器概要
构造器 构造器 说明 StepContext(StepExecution stepExecution)
Create a new instance ofStepContext
for thisStepExecution
.StepContext(StepExecution stepExecution, BatchPropertyContext propertyContext)
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 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. two contexts are only equal if their step executions are the same).java.lang.String
getId()
java.util.Map<java.lang.String,java.lang.Object>
getJobExecutionContext()
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 currentStepExecution
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()
从类继承的方法 org.springframework.batch.repeat.context.SynchronizedAttributeAccessor
attributeNames, getAttribute, hasAttribute, setAttribute, setAttributeIfAbsent
构造器详细资料
StepContext
public StepContext(StepExecution stepExecution)
Create a new instance ofStepContext
for thisStepExecution
.- 参数:
stepExecution
- a step execution
StepContext
public StepContext(StepExecution stepExecution, BatchPropertyContext propertyContext)
方法详细资料
getStepName
public java.lang.String getStepName()
Convenient accessor for current step name identifier. Usually this is the same as the bean name of the step that is executing (but might not be e.g. in a partition).- 返回:
- the step name identifier of the current
StepExecution
getJobName
public java.lang.String getJobName()
Convenient accessor for current job name identifier.- 返回:
- the job name identifier of the enclosing
JobInstance
associated with the currentStepExecution
getSystemProperties
public java.util.Properties getSystemProperties()
Convenient accessor for System properties to make it easy to access them from placeholder expressions.- 返回:
- the current System properties
getStepExecutionContext
public java.util.Map<java.lang.String,java.lang.Object> getStepExecutionContext()
- 返回:
- a map containing the items from the step
ExecutionContext
getJobExecutionContext
public java.util.Map<java.lang.String,java.lang.Object> getJobExecutionContext()
- 返回:
- a map containing the items from the job
ExecutionContext
getJobParameters
public java.util.Map<java.lang.String,java.lang.Object> getJobParameters()
- 返回:
- a map containing the items from the
JobParameters
getPartitionPlan
public java.util.Map<java.lang.String,java.lang.Object> getPartitionPlan()
registerDestructionCallback
public void registerDestructionCallback(java.lang.String name, java.lang.Runnable callback)
Allow clients to register callbacks for clean up on close.- 参数:
name
- the callback id (unique attribute key in this context)callback
- a callback to execute on close
removeAttribute
@Nullable public java.lang.Object removeAttribute(java.lang.String name)
Override base class behaviour to ensure destruction callbacks are unregistered as well as the default behaviour.- 指定者:
removeAttribute
在接口中org.springframework.core.AttributeAccessor
- 覆盖:
removeAttribute
在类中SynchronizedAttributeAccessor
- 另请参阅:
SynchronizedAttributeAccessor.removeAttribute(String)
close
public void close()
Clean up the context at the end of a step execution. Must be called once at the end of a step execution to honour the destruction callback contract from theStepScope
.
getStepExecution
public StepExecution getStepExecution()
The currentStepExecution
that is active in this context.- 返回:
- the current
StepExecution
getId
public java.lang.String getId()
- 返回:
- unique identifier for this context based on the step execution
equals
public boolean equals(java.lang.Object other)
Extend the base class method to include the step execution itself as a key (i.e. two contexts are only equal if their step executions are the same).
hashCode
public int hashCode()
Overrides the default behaviour to provide a hash code based only on the step execution.
toString
public java.lang.String toString()