Class ScheduleParams


  • public class ScheduleParams
    extends Object
    This class contains information about the scheduled time for one run of a ScheduledTask. It can contain a local time or a UTC time. This depends on the TaskSchedule.
    • Constructor Summary

      Constructors 
      Constructor Description
      ScheduleParams()
      This default constructor is used for JSON serialization.
      ScheduleParams​(long utcTime, boolean exact)
      Constructs a new instance with a UTC time.
      ScheduleParams​(org.joda.time.LocalDateTime localTime, boolean exact)
      Constructs a new instance with a local time.
    • Constructor Detail

      • ScheduleParams

        public ScheduleParams()
        This default constructor is used for JSON serialization.
      • ScheduleParams

        public ScheduleParams​(org.joda.time.LocalDateTime localTime,
                              boolean exact)
        Constructs a new instance with a local time.
        Parameters:
        localTime - the local time
        exact - true if the task should be run exactly at the specified time, false if it can be run later to save energy
      • ScheduleParams

        public ScheduleParams​(long utcTime,
                              boolean exact)
        Constructs a new instance with a UTC time.
        Parameters:
        utcTime - the UTC time
        exact - true if the task should be run exactly at the specified time, false if it can be run later to save energy
    • Method Detail

      • getLocalTime

        public org.joda.time.LocalDateTime getLocalTime()
        If this is a schedule with a local time, this method returns the time. Otherwise it returns null and getUtcTime() should return a UTC time.
        Returns:
        the local time or null
      • setLocalTime

        public void setLocalTime​(org.joda.time.LocalDateTime localTime)
        Sets the local time. For a schedule with a UTC time, you should not call this method but use setUtcTime().
        Parameters:
        localTime - the local time
      • getUtcTime

        public Long getUtcTime()
        If this is a schedule with a UTC time, this method returns the unix time in milliseconds. Otherwise it returns null and getLocalTime() should return a local time.
        Returns:
        the UTC time or null
      • setUtcTime

        public void setUtcTime​(Long utcTime)
        Sets the UTC time. For a schedule with a local time, you should not call this method but use setLocalTime().
        Parameters:
        utcTime - the UTC time
      • isExact

        public boolean isExact()
        Returns whether the task should be run exactly at the specified time, or whether it can be run later to save energy.
        Returns:
        true if the task should be run exactly at the specified time, false if it can be run later to save energy
      • setExact

        public void setExact​(boolean exact)
        Sets whether the task should be run exactly at the specified time, or whether it can be run later to save energy.
        Parameters:
        exact - true if the task should be run exactly at the specified time, false if it can be run later to save energy