Class CronAdjuster

All Implemented Interfaces:
TemporalAdjuster, SchedulerTemporalAdjuster

@NonNullByDefault public class CronAdjuster extends Object implements SchedulerTemporalAdjuster
This class creates a TemporalAdjuster that takes a temporal and adjust it to the next deadline based on a cron specification.
Peter Kriens - Initial contribution, Hilbrand Bouwkamp - code cleanup
  • Field Details

  • Constructor Details

    • CronAdjuster

      public CronAdjuster(String specification)
      Constructs the class with a cron specification. containing variables and a cron expression at the last line.
  • Method Details

    • getEnv

      public Map<String,String> getEnv()
      Returns a map with variables passed in the specification.
    • isReboot

      public boolean isReboot()
      Returns true if this cron has been initialized with @reboot.
    • isDone

      public boolean isDone(Temporal temporal)
      Description copied from interface: SchedulerTemporalAdjuster
      Used by the scheduler to determine if it should continue scheduling jobs. If returns true the implementation of this interface determines the job should not run again given. No new job will be scheduled.
      Specified by:
      isDone in interface SchedulerTemporalAdjuster
      temporal - The temporal to determine if the next run should be scheduled
      true if running is done and the job should not run anymore.
    • adjustInto

      public Temporal adjustInto(@Nullable Temporal temporal)
      Specified by:
      adjustInto in interface TemporalAdjuster