Package org.glassfish.common.util.timer
Class TimerSchedule
- java.lang.Object
-
- org.glassfish.common.util.timer.TimerSchedule
-
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
EJBTimerSchedule
public class TimerSchedule extends Object implements Serializable
This class converts a cron-like string to its internal representation and calculates the next timeout after the current timestamp.- Author:
- mvatkina
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description TimerSchedule()Construct TimerSchedule instance with all defaults.TimerSchedule(String s)Construct TimerSchedule instance from a given String.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidconfigure()Populate all internale structures to be used for the next timeout calculationsTimerScheduledayOfMonth(String d)TimerScheduledayOfWeek(String d)TimerScheduleend(Date e)booleanequals(Object o)StringgetDayOfMonth()StringgetDayOfWeek()DategetEnd()StringgetHour()StringgetMinute()StringgetMonth()CalendargetNextTimeout()Returns the Date of the next possible timeout.CalendargetNextTimeout(Date date)Returns the Date of the next possible timeout after the specific date.StringgetScheduleAsString()StringgetSecond()DategetStart()TimeZonegetTimeZone()StringgetTimeZoneID()StringgetYear()inthashCode()TimerSchedulehour(String h)protected booleanisExpectedElementCount(String[] el)Validate number of elements in the input stringbooleanisValid(Calendar date)Returns true if this date can be used for the next timeout of the schedule represented by this instance.TimerScheduleminute(String m)TimerSchedulemonth(String m)TimerSchedulesecond(String s)TimerSchedulestart(Date s)TimerScheduletimezone(String tz)TimerScheduleyear(String y)
-
-
-
Constructor Detail
-
TimerSchedule
public TimerSchedule()
Construct TimerSchedule instance with all defaults.
-
TimerSchedule
public TimerSchedule(String s)
Construct TimerSchedule instance from a given String.
-
-
Method Detail
-
second
public TimerSchedule second(String s)
-
getSecond
public String getSecond()
-
minute
public TimerSchedule minute(String m)
-
getMinute
public String getMinute()
-
hour
public TimerSchedule hour(String h)
-
getHour
public String getHour()
-
dayOfMonth
public TimerSchedule dayOfMonth(String d)
-
getDayOfMonth
public String getDayOfMonth()
-
month
public TimerSchedule month(String m)
-
getMonth
public String getMonth()
-
dayOfWeek
public TimerSchedule dayOfWeek(String d)
-
getDayOfWeek
public String getDayOfWeek()
-
year
public TimerSchedule year(String y)
-
getYear
public String getYear()
-
timezone
public TimerSchedule timezone(String tz)
-
getTimeZoneID
public String getTimeZoneID()
-
getTimeZone
public TimeZone getTimeZone()
-
start
public TimerSchedule start(Date s)
-
getStart
public Date getStart()
-
end
public TimerSchedule end(Date e)
-
getEnd
public Date getEnd()
-
getScheduleAsString
public String getScheduleAsString()
-
isValid
public boolean isValid(Calendar date)
Returns true if this date can be used for the next timeout of the schedule represented by this instance.
-
getNextTimeout
public Calendar getNextTimeout()
Returns the Date of the next possible timeout.
-
getNextTimeout
public Calendar getNextTimeout(Date date)
Returns the Date of the next possible timeout after the specific date.
-
isExpectedElementCount
protected boolean isExpectedElementCount(String[] el)
Validate number of elements in the input string
-
configure
protected void configure()
Populate all internale structures to be used for the next timeout calculations
-
-