public static CronConstraint ensureEitherDayOfYearOrMonth() {
        return new CronConstraint("Both, a day-of-year AND a day-of-month or day-of-week, are not supported.") {
            private static final long serialVersionUID = 520379111876897579L;

            @Override
            public boolean validate(Cron cron) {
                CronField dayOfYearField = cron.retrieve(CronFieldName.DAY_OF_YEAR);
                if (dayOfYearField != null && !(dayOfYearField.getExpression() instanceof QuestionMark)) {
                    return cron.retrieve(CronFieldName.DAY_OF_WEEK).getExpression() instanceof QuestionMark
                            && cron.retrieve(CronFieldName.DAY_OF_MONTH).getExpression() instanceof QuestionMark;
                }

                return true;
            }
        };
    }
public static CronConstraint ensureEitherDayOfYearOrMonth ( ) { return new CronConstraint ( "Both, a day-of-year AND a day-of-month or day-of-week, are not supported." ) { private static final long serialVersionUID = 520379111876897579L ; @ Override public boolean validate ( Cron cron ) { CronField dayOfYearField = cron . retrieve ( CronFieldName . DAY_OF_YEAR ) ; if ( dayOfYearField != null && ! ( dayOfYearField . getExpression ( ) instanceof QuestionMark ) ) { return cron . retrieve ( CronFieldName . DAY_OF_WEEK ) . getExpression ( ) instanceof QuestionMark && cron . retrieve ( CronFieldName . DAY_OF_MONTH ) . getExpression ( ) instanceof QuestionMark ; } return true ; } } ; }
Creates CronConstraint to ensure that either day-of-year or month is assigned a specific value.

@return newly created CronConstraint instance, never {@code null};