Package eu.woolplatform.utils.schedule
Class ScheduleParams
- java.lang.Object
-
- eu.woolplatform.utils.schedule.ScheduleParams
-
public class ScheduleParams extends Object
This class contains information about the scheduled time for one run of aScheduledTask. It can contain a local time or a UTC time. This depends on theTaskSchedule.
-
-
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.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.joda.time.LocalDateTimegetLocalTime()If this is a schedule with a local time, this method returns the time.LonggetUtcTime()If this is a schedule with a UTC time, this method returns the unix time in milliseconds.booleanisExact()Returns whether the task should be run exactly at the specified time, or whether it can be run later to save energy.voidsetExact(boolean exact)Sets whether the task should be run exactly at the specified time, or whether it can be run later to save energy.voidsetLocalTime(org.joda.time.LocalDateTime localTime)Sets the local time.voidsetUtcTime(Long utcTime)Sets the UTC 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 timeexact- 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 timeexact- 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 andgetUtcTime()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 usesetUtcTime().- 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 andgetLocalTime()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 usesetLocalTime().- 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
-
-