Package org.springframework.scheduling.support

# Class SimpleTriggerContext

java.lang.Object
org.springframework.scheduling.support.SimpleTriggerContext

All Implemented Interfaces:
  `TriggerContext`

public class SimpleTriggerContext extends Object implements TriggerContext
Simple data holder implementation of the `TriggerContext` interface.

Since:
  3.0
Author:
  Juergen Hoeller

## Constructor Summary

Constructors
Constructor
Description
`SimpleTriggerContext()`
Create a SimpleTriggerContext with all time values set to `null`, exposing the system clock for the default time zone.
`SimpleTriggerContext(Clock clock)`
Create a SimpleTriggerContext with all time values set to `null`, exposing the given clock.
`SimpleTriggerContext(Instant lastScheduledExecution, Instant lastActualExecution, Instant lastCompletion)`
Create a SimpleTriggerContext with the given time values, exposing the system clock for the default time zone.
`SimpleTriggerContext(Date lastScheduledExecutionTime, Date lastActualExecutionTime, Date lastCompletionTime)`
Deprecated.
as of 6.0, in favor of `SimpleTriggerContext(Instant, Instant, Instant)`

## Method Summary

Modifier and Type
Method
Description
`Clock`
`getClock()`
Return the clock to use for trigger calculation.
`Instant`
`lastActualExecution()`
Return the last actual execution time of the task, or `null` if not scheduled before.
`Instant`
`lastCompletion()`
Return the last completion time of the task, or `null` if not scheduled before.
`Instant`
`lastScheduledExecution()`
Return the last scheduled execution time of the task, or `null` if not scheduled before.
`void`
`update(Instant lastScheduledExecution, Instant lastActualExecution, Instant lastCompletion)`
Update this holder's state with the latest time values.
`void`
`update(Date lastScheduledExecutionTime, Date lastActualExecutionTime, Date lastCompletionTime)`
Deprecated.
as of 6.0, in favor of `update(Instant, Instant, Instant)`

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

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

### Methods inherited from interface org.springframework.scheduling.TriggerContext

`lastActualExecutionTime, lastCompletionTime, lastScheduledExecutionTime`

## Constructor Details

### SimpleTriggerContext

public SimpleTriggerContext()
Create a SimpleTriggerContext with all time values set to `null`, exposing the system clock for the default time zone.

### SimpleTriggerContext

@Deprecated(since="6.0") public SimpleTriggerContext(@Nullable Date lastScheduledExecutionTime, @Nullable Date lastActualExecutionTime, @Nullable Date lastCompletionTime)
Deprecated.
as of 6.0, in favor of `SimpleTriggerContext(Instant, Instant, Instant)`
Create a SimpleTriggerContext with the given time values, exposing the system clock for the default time zone.

Parameters:
  `lastScheduledExecutionTime` - last scheduled execution time
  `lastActualExecutionTime` - last actual execution time
  `lastCompletionTime` - last completion time

### SimpleTriggerContext

public SimpleTriggerContext(@Nullable Instant lastScheduledExecution, @Nullable Instant lastActualExecution, @Nullable Instant lastCompletion)
Create a SimpleTriggerContext with the given time values, exposing the system clock for the default time zone.

Parameters:
  `lastScheduledExecution` - last scheduled execution time
  `lastActualExecution` - last actual execution time
  `lastCompletion` - last completion time

### SimpleTriggerContext

public SimpleTriggerContext(Clock clock)
Create a SimpleTriggerContext with all time values set to `null`, exposing the given clock.

Parameters:
  `clock` - the clock to use for trigger calculation
Since:
  5.3
See Also:
  - `update(Instant, Instant, Instant)`

## Method Details

### update

@Deprecated(since="6.0") public void update(@Nullable Date lastScheduledExecutionTime, @Nullable Date lastActualExecutionTime, @Nullable Date lastCompletionTime)
Deprecated.
as of 6.0, in favor of `update(Instant, Instant, Instant)`
Update this holder's state with the latest time values.

Parameters:
  `lastScheduledExecutionTime` - last scheduled execution time
  `lastActualExecutionTime` - last actual execution time
  `lastCompletionTime` - last completion time

### update

public void update(@Nullable Instant lastScheduledExecution, @Nullable Instant lastActualExecution, @Nullable Instant lastCompletion)
Update this holder's state with the latest time values.

Parameters:
  `lastScheduledExecution` - last scheduled execution time
  `lastActualExecution` - last actual execution time
  `lastCompletion` - last completion time

### getClock

public Clock getClock()
Description copied from interface: `TriggerContext`
Return the clock to use for trigger calculation.

Defaults to `Clock.systemDefaultZone()`.

Specified by:
  `getClock` in interface `TriggerContext`
See Also:
  - `TaskScheduler.getClock()`

### lastScheduledExecution

@Nullable public Instant lastScheduledExecution()
Description copied from interface: `TriggerContext`
Return the last scheduled execution time of the task, or `null` if not scheduled before.

Specified by:
  `lastScheduledExecution` in interface `TriggerContext`

### lastActualExecution

@Nullable public Instant lastActualExecution()
Description copied from interface: `TriggerContext`
Return the last actual execution time of the task, or `null` if not scheduled before.

Specified by:
  `lastActualExecution` in interface `TriggerContext`

### lastCompletion

@Nullable public Instant lastCompletion()
Description copied from interface: `TriggerContext`
Return the last completion time of the task, or `null` if not scheduled before.

Specified by:
  `lastCompletion` in interface `TriggerContext`