Class MatcherSchedule

java.lang.Object
com.aoapps.cron.MatcherSchedule
All Implemented Interfaces:
Schedule

public class MatcherSchedule extends Object implements Schedule
Parses a cron-like schedule line, including support for lists, steps, ranges, asterisks, names, and special strings. This also extends the syntax to allow multiple cron-like schedules separated by semicolon (;).

See man 5 crontab

Author:
AO Industries, Inc.
See Also:
  • Constructor Details

  • Method Details

    • parseSchedule

      public static Schedule parseSchedule(String str) throws IllegalArgumentException
      Parses an entire schedule.
      Throws:
      IllegalArgumentException
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getMinute

      public Matcher getMinute()
    • getHour

      public Matcher getHour()
    • getDayOfMonth

      public Matcher getDayOfMonth()
    • getMonth

      public Matcher getMonth()
      Note: months are 1-12 like cron, not 0-11 like Calendar.
    • getDayOfWeek

      public Matcher getDayOfWeek()
      Note: Sunday is 0, not 1 like Calendar.
    • isScheduled

      public boolean isScheduled(int minute, int hour, int dayOfMonth, int month, int dayOfWeek, int year)
      Description copied from interface: Schedule
      Determine if the job should run right now.
      Specified by:
      isScheduled in interface Schedule
      Parameters:
      minute - 0-59
      hour - 0-23
      dayOfMonth - 1-31
      month - 0-11
      dayOfWeek - 1-7, Calendar.SUNDAY through Calendar.SATURDAY