- All Implemented Interfaces:
public class JobContext extends SynchronizedAttributeAccessor
A context object that can be used to interrogate the current
JobExecutionand some of its associated properties using expressions based on bean paths. Has public getters for the job execution and convenience methods for accessing commonly used properties like the
ExecutionContextassociated with the job execution.
- Dave Syer, Jimmy Praet (create JobContext based on
StepContext), Mahmoud Ben Hassine
Method SummaryModifier and TypeMethodDescription
close()Clean up the context at the end of a step execution.
booleanExtend the base class method to include the job execution itself as a key (i.e.
getId()Convenient accessor for current job name identifier.Convenient accessor for System properties to make it easy to access them from placeholder expressions.
hashCode()Overrides the default behaviour to provide a hash code based only on the job execution.
voidAllow clients to register callbacks for clean up on close.Override base class behaviour to ensure destruction callbacks are unregistered as well as the default behaviour.
Methods inherited from class org.springframework.batch.repeat.context.SynchronizedAttributeAccessor
attributeNames, getAttribute, hasAttribute, setAttribute, setAttributeIfAbsent
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.springframework.core.AttributeAccessor
getJobNamepublic String getJobName()Convenient accessor for current job name identifier.
getSystemPropertiespublic Properties getSystemProperties()Convenient accessor for System properties to make it easy to access them from placeholder expressions.
- the current System properties
- a map containing the items from the job
- a map containing the items from the
registerDestructionCallbackAllow 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
removeAttributeOverride base class behaviour to ensure destruction callbacks are unregistered as well as the default behaviour.
- Specified by:
- See Also:
closepublic 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 the
getJobExecutionpublic JobExecution getJobExecution()
- the current
getIdpublic String getId()
- unique identifier for this context based on the step execution
equalspublic boolean equals
(Object other)Extend the base class method to include the job execution itself as a key (i.e. two contexts are only equal if their job executions are the same).
hashCodepublic int hashCode()Overrides the default behaviour to provide a hash code based only on the job execution.
toStringpublic String toString()