public final class CronTab extends Object
Constructor and Description |
---|
CronTab(String format) |
CronTab(String format,
Hash hash) |
CronTab(String format,
int line)
Deprecated.
as of 1.448
Use
CronTab(String, int, Hash) |
CronTab(String format,
int line,
Hash hash) |
CronTab(String format,
int line,
Hash hash,
String timezone) |
Modifier and Type | Method and Description |
---|---|
Calendar |
ceil(Calendar cal)
See
ceil(long) . |
Calendar |
ceil(long t)
Computes the nearest future timestamp that matches this cron tab.
|
String |
checkSanity()
Checks if this crontab entry looks reasonable,
and if not, return an warning message.
|
Calendar |
floor(Calendar cal)
See
floor(long)
This method modifies the given calendar and returns the same object. |
Calendar |
floor(long t)
Computes the nearest past timestamp that matched this cron tab.
|
TimeZone |
getTimeZone()
Returns the configured time zone, or null if none is configured
|
static String |
hashify(String spec)
Checks a prospective crontab specification to see if it could benefit from balanced hashes.
|
String |
toString() |
public CronTab(String format) throws antlr.ANTLRException
antlr.ANTLRException
public CronTab(String format, Hash hash) throws antlr.ANTLRException
antlr.ANTLRException
@Deprecated public CronTab(String format, int line) throws antlr.ANTLRException
CronTab(String, int, Hash)
antlr.ANTLRException
public CronTab(String format, int line, Hash hash) throws antlr.ANTLRException
hash
- Used to spread out token like "@daily". Null to preserve the legacy behaviour
of not spreading it out at all.antlr.ANTLRException
public Calendar ceil(long t)
More precisely, given the time 't', computes another smallest time x such that:
Note that if t already matches this cron, it's returned as is.
public Calendar ceil(Calendar cal)
ceil(long)
.
This method modifies the given calendar and returns the same object.RareOrImpossibleDateException
- if the date isn't hit in the 2 years after it indicates an impossible
(e.g. Jun 31) date, or at least a date too rare to be useful. This addresses JENKINS-41864 and was added in 2.49public Calendar floor(long t)
More precisely, given the time 't', computes another smallest time x such that:
Note that if t already matches this cron, it's returned as is.
public Calendar floor(Calendar cal)
floor(long)
This method modifies the given calendar and returns the same object.RareOrImpossibleDateException
- if the date isn't hit in the 2 years before it indicates an impossible
(e.g. Jun 31) date, or at least a date too rare to be useful. This addresses JENKINS-41864 and was added in 2.49@CheckForNull public String checkSanity()
The point of this method is to catch syntactically correct but semantically suspicious combinations, like "* 0 * * *"
@CheckForNull public static String hashify(String spec)
spec
- a (legal) spec@CheckForNull public TimeZone getTimeZone()
Copyright © 2004–2021. All rights reserved.