1 package com.atlassian.scheduler.cron;
2
3 import com.atlassian.annotations.PublicApi;
4
5 /**
6 * @since v1.4
7 */
8 @PublicApi
9 public interface CronExpressionValidator {
10 /**
11 * Returns {@code true} if the cron expression can be parsed successfully.
12 * <p>
13 * This is equivalent to calling {@link #validate(String)} except that it returns a boolean value
14 * as opposed to throwing an exception when the expression is not valid.
15 * </p>
16 *
17 * @param cronExpression the cron expression to be considered
18 * @return {@code true} if the cron expression can be parsed successfully; {@code false} otherwise.
19 */
20 boolean isValid(String cronExpression);
21
22 /**
23 * Validates that a cron expression can be successfully parsed.
24 *
25 * @param cronExpression the cron expression to be considered
26 * @throws CronSyntaxException if the cron expression contains invalid syntax
27 */
28 void validate(String cronExpression) throws CronSyntaxException;
29 }