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 void
configure()
Populate all internale structures to be used for the next timeout calculationsTimerSchedule
dayOfMonth(String d)
TimerSchedule
dayOfWeek(String d)
TimerSchedule
end(Date e)
boolean
equals(Object o)
String
getDayOfMonth()
String
getDayOfWeek()
Date
getEnd()
String
getHour()
String
getMinute()
String
getMonth()
Calendar
getNextTimeout()
Returns the Date of the next possible timeout.Calendar
getNextTimeout(Date date)
Returns the Date of the next possible timeout after the specific date.String
getScheduleAsString()
String
getSecond()
Date
getStart()
TimeZone
getTimeZone()
String
getTimeZoneID()
String
getYear()
int
hashCode()
TimerSchedule
hour(String h)
protected boolean
isExpectedElementCount(String[] el)
Validate number of elements in the input stringboolean
isValid(Calendar date)
Returns true if this date can be used for the next timeout of the schedule represented by this instance.TimerSchedule
minute(String m)
TimerSchedule
month(String m)
TimerSchedule
second(String s)
TimerSchedule
start(Date s)
TimerSchedule
timezone(String tz)
TimerSchedule
year(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
-
-