Record Class TaskContext

java.lang.Object
java.lang.Record
com.elex_project.chronos.TaskContext

public record TaskContext(String taskId, Runnable task, long interval, TimeUnit timeUnit, Set<DayOfWeek> daysOfWeek, int dayOfMonth, boolean isLastDayOfMonth, int hour, int minute, String cronExpression, long initialDelay, TimeUnit initialDelayUnit, OverlapPolicy policy, ChronosListener.Start startListener, ChronosListener.Success successListener, ChronosListener.Failure failureListener) extends Record
  • Constructor Details

    • TaskContext

      public TaskContext(String taskId, Runnable task, long interval, TimeUnit timeUnit, Set<DayOfWeek> daysOfWeek, int dayOfMonth, boolean isLastDayOfMonth, int hour, int minute, String cronExpression, long initialDelay, TimeUnit initialDelayUnit, OverlapPolicy policy, ChronosListener.Start startListener, ChronosListener.Success successListener, ChronosListener.Failure failureListener)
      Creates an instance of a TaskContext record class.
      Parameters:
      taskId - the value for the taskId record component
      task - the value for the task record component
      interval - the value for the interval record component
      timeUnit - the value for the timeUnit record component
      daysOfWeek - the value for the daysOfWeek record component
      dayOfMonth - the value for the dayOfMonth record component
      isLastDayOfMonth - the value for the isLastDayOfMonth record component
      hour - the value for the hour record component
      minute - the value for the minute record component
      cronExpression - the value for the cronExpression record component
      initialDelay - the value for the initialDelay record component
      initialDelayUnit - the value for the initialDelayUnit record component
      policy - the value for the policy record component
      startListener - the value for the startListener record component
      successListener - the value for the successListener record component
      failureListener - the value for the failureListener record component
  • Method Details

    • isWeekly

      public boolean isWeekly()
    • isMonthly

      public boolean isMonthly()
    • isCron

      public boolean isCron()
    • getIntervalMillis

      public long getIntervalMillis()
    • getInitialDelayMillis

      public long getInitialDelayMillis()
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • taskId

      public String taskId()
      Returns the value of the taskId record component.
      Returns:
      the value of the taskId record component
    • task

      public Runnable task()
      Returns the value of the task record component.
      Returns:
      the value of the task record component
    • interval

      public long interval()
      Returns the value of the interval record component.
      Returns:
      the value of the interval record component
    • timeUnit

      public TimeUnit timeUnit()
      Returns the value of the timeUnit record component.
      Returns:
      the value of the timeUnit record component
    • daysOfWeek

      public Set<DayOfWeek> daysOfWeek()
      Returns the value of the daysOfWeek record component.
      Returns:
      the value of the daysOfWeek record component
    • dayOfMonth

      public int dayOfMonth()
      Returns the value of the dayOfMonth record component.
      Returns:
      the value of the dayOfMonth record component
    • isLastDayOfMonth

      public boolean isLastDayOfMonth()
      Returns the value of the isLastDayOfMonth record component.
      Returns:
      the value of the isLastDayOfMonth record component
    • hour

      public int hour()
      Returns the value of the hour record component.
      Returns:
      the value of the hour record component
    • minute

      public int minute()
      Returns the value of the minute record component.
      Returns:
      the value of the minute record component
    • cronExpression

      public String cronExpression()
      Returns the value of the cronExpression record component.
      Returns:
      the value of the cronExpression record component
    • initialDelay

      public long initialDelay()
      Returns the value of the initialDelay record component.
      Returns:
      the value of the initialDelay record component
    • initialDelayUnit

      public TimeUnit initialDelayUnit()
      Returns the value of the initialDelayUnit record component.
      Returns:
      the value of the initialDelayUnit record component
    • policy

      public OverlapPolicy policy()
      Returns the value of the policy record component.
      Returns:
      the value of the policy record component
    • startListener

      public ChronosListener.Start startListener()
      Returns the value of the startListener record component.
      Returns:
      the value of the startListener record component
    • successListener

      public ChronosListener.Success successListener()
      Returns the value of the successListener record component.
      Returns:
      the value of the successListener record component
    • failureListener

      public ChronosListener.Failure failureListener()
      Returns the value of the failureListener record component.
      Returns:
      the value of the failureListener record component