• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Cron类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.cronutils.model.Cron的典型用法代码示例。如果您正苦于以下问题:Java Cron类的具体用法?Java Cron怎么用?Java Cron使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Cron类属于com.cronutils.model包,在下文中一共展示了Cron类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: newMirror

import com.cronutils.model.Cron; //导入依赖的package包/类
private static <T extends Mirror> T newMirror(String remoteUri, Class<T> mirrorType) {
    final MirrorCredential credential = mock(MirrorCredential.class);
    final Repository localRepo = mock(Repository.class);
    final Mirror mirror = Mirror.of(mock(Cron.class), MirrorDirection.LOCAL_TO_REMOTE,
                                    credential, localRepo, "/", URI.create(remoteUri));

    assertThat(mirror).isInstanceOf(mirrorType);
    assertThat(mirror.direction()).isEqualTo(MirrorDirection.LOCAL_TO_REMOTE);
    assertThat(mirror.credential()).isSameAs(credential);
    assertThat(mirror.localRepo()).isSameAs(localRepo);
    assertThat(mirror.localPath()).isEqualTo("/");

    @SuppressWarnings("unchecked")
    final T castMirror = (T) mirror;
    return castMirror;
}
 
开发者ID:line,项目名称:centraldogma,代码行数:17,代码来源:MirrorTest.java


示例2: parse

import com.cronutils.model.Cron; //导入依赖的package包/类
/**
 * Parse string with cron expression.
 *
 * @param expression - cron expression, never null
 * @return Cron instance, corresponding to cron expression received
 * @throws java.lang.IllegalArgumentException if expression does not match cron definition
 */
public Cron parse(final String expression) {
    Preconditions.checkNotNull(expression, "Expression must not be null");
    final String replaced = expression.replaceAll("\\s+", " ").trim();
    if (StringUtils.isEmpty(replaced)) {
        throw new IllegalArgumentException("Empty expression!");
    }
    final String[] expressionParts = replaced.toUpperCase().split(" ");
    final int expressionLength = expressionParts.length;
    final List<CronParserField> fields = expressions.get(expressionLength);
    if (fields == null) {
        throw new IllegalArgumentException(
                String.format("Cron expression contains %s parts but we expect one of %s", expressionLength, expressions.keySet()));
    }
    try {
        final int size = fields.size();
        final List<CronField> results = new ArrayList<>(size + 1);
        for (int j = 0; j < size; j++) {
            results.add(fields.get(j).parse(expressionParts[j]));
        }
        return new Cron(cronDefinition, results).validate();
    } catch (final IllegalArgumentException e) {
        throw new IllegalArgumentException(String.format("Failed to parse '%s'. %s", expression, e.getMessage()), e);
    }
}
 
开发者ID:jmrozanec,项目名称:cron-utils,代码行数:32,代码来源:CronParser.java


示例3: ensureEitherDayOfWeekOrDayOfMonth

import com.cronutils.model.Cron; //导入依赖的package包/类
public static CronConstraint ensureEitherDayOfWeekOrDayOfMonth() {
    //Solves issue #63: https://github.com/jmrozanec/cron-utils/issues/63
    //both a day-of-week AND a day-of-month parameter should fail for QUARTZ
    return new CronConstraint("Both, a day-of-week AND a day-of-month parameter, are not supported.") {
        private static final long serialVersionUID = -4423693913868081656L;

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

            return true;
        }
    };
}
 
开发者ID:jmrozanec,项目名称:cron-utils,代码行数:22,代码来源:CronConstraintsFactory.java


示例4: testCronExpressionEveryTwoHoursAsteriskSlash

import com.cronutils.model.Cron; //导入依赖的package包/类
/**
 * Test for issue #38
 * https://github.com/jmrozanec/cron-utils/issues/38
 * Reported case: lastExecution and nextExecution do not work properly
 * Expected: should return expected date
 */
@Test
public void testCronExpressionEveryTwoHoursAsteriskSlash() {
    final CronDefinition cronDefinition = CronDefinitionBuilder.defineCron()
            .withSeconds().and()
            .withMinutes().and()
            .withHours().and()
            .withDayOfMonth().and()
            .withMonth().and()
            .withDayOfWeek().withValidRange(0, 7).withMondayDoWValue(1).withIntMapping(7, 0).and()
            .instance();

    final CronParser parser = new CronParser(cronDefinition);
    final Cron cron = parser.parse("0 0 */2 * * *");
    final ZonedDateTime startDateTime = ZonedDateTime.parse("2015-08-28T12:05:14.000-03:00");

    final Optional<ZonedDateTime> nextExecution = ExecutionTime.forCron(cron).nextExecution(startDateTime);
    if (nextExecution.isPresent()) {
        assertTrue(ZonedDateTime.parse("2015-08-28T14:00:00.000-03:00").compareTo(nextExecution.get()) == 0);
    } else {
        fail(NEXT_EXECUTION_NOT_PRESENT_ERROR);
    }
}
 
开发者ID:jmrozanec,项目名称:cron-utils,代码行数:29,代码来源:ExecutionTimeCustomDefinitionIntegrationTest.java


示例5: setQuestionMark

import com.cronutils.model.Cron; //导入依赖的package包/类
private static Function<Cron, Cron> setQuestionMark() {
    return cron -> {
        final CronField dow = cron.retrieve(CronFieldName.DAY_OF_WEEK);
        final CronField dom = cron.retrieve(CronFieldName.DAY_OF_MONTH);
        if (dow == null && dom == null) {
            return cron;
        }
        if (dow.getExpression() instanceof QuestionMark || dom.getExpression() instanceof QuestionMark) {
            return cron;
        }
        final Map<CronFieldName, CronField> fields = new EnumMap<>(CronFieldName.class);
        fields.putAll(cron.retrieveFieldsAsMap());
        if (dow.getExpression() instanceof Always) {
            fields.put(CronFieldName.DAY_OF_WEEK,
                    new CronField(CronFieldName.DAY_OF_WEEK, questionMark(), fields.get(CronFieldName.DAY_OF_WEEK).getConstraints()));
        } else {
            if (dom.getExpression() instanceof Always) {
                fields.put(CronFieldName.DAY_OF_MONTH,
                        new CronField(CronFieldName.DAY_OF_MONTH, questionMark(), fields.get(CronFieldName.DAY_OF_MONTH).getConstraints()));
            } else {
                cron.validate();
            }
        }
        return new Cron(cron.getCronDefinition(), new ArrayList<>(fields.values()));
    };
}
 
开发者ID:jmrozanec,项目名称:cron-utils,代码行数:27,代码来源:CronMapper.java


示例6: testCronWithFirstWorkDayOfWeek

import com.cronutils.model.Cron; //导入依赖的package包/类
/**
 * Issue #75: W flag not behaving as expected: did not return first workday of month, but an exception.
 */
@Test
public void testCronWithFirstWorkDayOfWeek() {
    final String cronText = "0 0 12 1W * ? *";
    final Cron cron = parser.parse(cronText);
    final ZonedDateTime dt = ZonedDateTime.parse("2016-03-29T00:00:59Z");

    final ExecutionTime executionTime = ExecutionTime.forCron(cron);
    final Optional<ZonedDateTime> nextExecution = executionTime.nextExecution(dt);
    if (nextExecution.isPresent()) {
        final ZonedDateTime nextRun = nextExecution.get();
        assertEquals("incorrect Day", nextRun.getDayOfMonth(), 1); // should be April 1st (Friday)
    } else {
        fail(NEXT_EXECUTION_NOT_PRESENT_ERROR);
    }
}
 
开发者ID:jmrozanec,项目名称:cron-utils,代码行数:19,代码来源:ExecutionTimeQuartzIntegrationTest.java


示例7: testMustMatchCronEvenIfNanoSecondsVaries

import com.cronutils.model.Cron; //导入依赖的package包/类
@Test
public void testMustMatchCronEvenIfNanoSecondsVaries() {
    final CronDefinition cronDefinition =
            CronDefinitionBuilder.instanceDefinitionFor(QUARTZ);

    final CronParser parser = new CronParser(cronDefinition);
    final Cron quartzCron = parser.parse("00 00 10 * * ?");

    quartzCron.validate();

    // NOTE: Off by 3 nano seconds
    final ZonedDateTime zdt = ZonedDateTime.of(1999, 07, 18, 10, 00, 00, 03, ZoneId.systemDefault());

    // Must be true
    assertTrue("Nano seconds must not affect matching of Cron Expressions", ExecutionTime.forCron(quartzCron).isMatch(zdt));
}
 
开发者ID:jmrozanec,项目名称:cron-utils,代码行数:17,代码来源:Issue200Test.java


示例8: testDescribeEveryXTimeUnits

import com.cronutils.model.Cron; //导入依赖的package包/类
@Test
public void testDescribeEveryXTimeUnits() {
    final int time = 3;
    final Every expression = new Every(new IntegerFieldValue(time));
    assertEquals(String.format("every %s seconds", time), descriptor.describe(
            new Cron(mockDefinition, Collections.singletonList(new CronField(CronFieldName.SECOND, expression, nullFieldConstraints)))
            )
    );
    assertEquals(String.format("every %s minutes", time), descriptor.describe(
            new Cron(mockDefinition, Collections.singletonList(new CronField(CronFieldName.MINUTE, expression, nullFieldConstraints)))
            )
    );
    final List<CronField> params = new ArrayList<>();
    params.add(new CronField(CronFieldName.HOUR, expression, nullFieldConstraints));
    params.add(new CronField(CronFieldName.MINUTE, new On(new IntegerFieldValue(time)), nullFieldConstraints));
    assertEquals(String.format("every %s hours at minute %s", time, time), descriptor.describe(new Cron(mockDefinition, params)));
}
 
开发者ID:jmrozanec,项目名称:cron-utils,代码行数:18,代码来源:CronDescriptorTest.java


示例9: testNextExecution2014

import com.cronutils.model.Cron; //导入依赖的package包/类
/**
 * Issue #79: Next execution skipping valid date.
 */
@Test
public void testNextExecution2014() {
    final String crontab = "0 8 * * 1";//m,h,dom,m,dow ; every monday at 8AM
    final CronDefinition cronDefinition = CronDefinitionBuilder.instanceDefinitionFor(CronType.UNIX);
    final CronParser parser = new CronParser(cronDefinition);
    final Cron cron = parser.parse(crontab);
    final ZonedDateTime date = ZonedDateTime.parse("2014-11-30T00:00:00Z");
    final ExecutionTime executionTime = ExecutionTime.forCron(cron);
    final Optional<ZonedDateTime> nextExecution = executionTime.nextExecution(date);
    if (nextExecution.isPresent()) {
        assertEquals(ZonedDateTime.parse("2014-12-01T08:00:00Z"), nextExecution.get());
    } else {
        fail(NEXT_EXECUTION_NOT_PRESENT_ERROR);
    }

}
 
开发者ID:jmrozanec,项目名称:cron-utils,代码行数:20,代码来源:ExecutionTimeUnixIntegrationTest.java


示例10: testCronExpressionEveryTwoHoursSlash

import com.cronutils.model.Cron; //导入依赖的package包/类
/**
 * Test for issue #38
 * https://github.com/jmrozanec/cron-utils/issues/38
 * Reported case: lastExecution and nextExecution do not work properly
 * Expected: should return expected date
 */
@Test
public void testCronExpressionEveryTwoHoursSlash() {
    final CronDefinition cronDefinition = CronDefinitionBuilder.defineCron()
            .withSeconds().and()
            .withMinutes().and()
            .withHours().and()
            .withDayOfMonth().and()
            .withMonth().and()
            .withDayOfWeek().withValidRange(0, 7).withMondayDoWValue(1).withIntMapping(7, 0).and()
            .instance();

    final CronParser parser = new CronParser(cronDefinition);
    final Cron cron = parser.parse("0 0 /2 * * *");
    final ZonedDateTime startDateTime = ZonedDateTime.parse("2015-08-28T12:05:14.000-03:00");

    final Optional<ZonedDateTime> nextExecution = ExecutionTime.forCron(cron).nextExecution(startDateTime);
    if (nextExecution.isPresent()) {
        assertTrue(ZonedDateTime.parse("2015-08-28T14:00:00.000-03:00").compareTo(nextExecution.get()) == 0);
    } else {
        fail(NEXT_EXECUTION_NOT_PRESENT_ERROR);
    }
}
 
开发者ID:jmrozanec,项目名称:cron-utils,代码行数:29,代码来源:ExecutionTimeCustomDefinitionIntegrationTest.java


示例11: lastDayOfTheWeek

import com.cronutils.model.Cron; //导入依赖的package包/类
/**
 * Issue #142: https://github.com/jmrozanec/cron-utils/pull/142
 * Special Character L for day of week behaves differently in Quartz
 * @throws ParseException in case the CronExpression can not be created
 */
@Test
public void lastDayOfTheWeek() throws ParseException {
    // L (“last”) - If used in the day-of-week field by itself, it simply means “7” or “SAT”.
    final Cron cron = new CronParser(CronDefinitionBuilder.instanceDefinitionFor(QUARTZ)).parse("0 0 0 ? * L *");

    final ZoneId utc = ZoneId.of("UTC");
    final ZonedDateTime date = LocalDate.parse("2016-12-22").atStartOfDay(utc);   // Thursday
    final ZonedDateTime expected = date.plusDays(2);   // Saturday

    final Optional<ZonedDateTime> nextExecution = ExecutionTime.forCron(cron).nextExecution(date);
    if (nextExecution.isPresent()) {
        final ZonedDateTime cronUtilsNextTime = nextExecution.get();// 2016-12-30T00:00:00Z

        final org.quartz.CronExpression cronExpression = new org.quartz.CronExpression(cron.asString());
        cronExpression.setTimeZone(TimeZone.getTimeZone(utc));
        final Date quartzNextTime = cronExpression.getNextValidTimeAfter(Date.from(date.toInstant()));// 2016-12-24T00:00:00Z

        assertEquals(expected.toInstant(), quartzNextTime.toInstant());    // test the reference implementation
        assertEquals(expected.toInstant(), cronUtilsNextTime.toInstant()); // and compare with cronUtils
    } else {
        fail(NEXT_EXECUTION_NOT_PRESENT_ERROR);
    }
}
 
开发者ID:jmrozanec,项目名称:cron-utils,代码行数:29,代码来源:ExecutionTimeQuartzIntegrationTest.java


示例12: checkCron

import com.cronutils.model.Cron; //导入依赖的package包/类
private boolean checkCron(String cronExpression, ZonedDateTime now) {
    try {
        if (cronExpression == null || cronExpression.isEmpty()) {
            return false;
        }
        Cron cron = parseCron(cronExpression);
        ExecutionTime executionTime = ExecutionTime.forCron(cron);
        ZonedDateTime last = executionTime.lastExecution(now);
        boolean b1 = last.isAfter(prevChecked);
        boolean b2 = last.isBefore(now);
        LOGGER.info("cron={} now={} last={} prevCheck={} b1={} b2={}", cronExpression, now.toString(), last.toString(), prevChecked.toString(), b1, b2);
        return (b1 && b2);
        //return (last.isAfter(lastChecked) && last.isBefore(now));
    } catch (Exception e) {
        LOGGER.error("Check cron '{}' failed, {}", cronExpression, e.getMessage());
        return false;
    }
}
 
开发者ID:Jukkorsis,项目名称:Hadrian,代码行数:19,代码来源:ScheduleRunner.java


示例13: testNextExecutionTimeProperlySet

import com.cronutils.model.Cron; //导入依赖的package包/类
/**
 * Issue #123:
 * https://github.com/jmrozanec/cron-utils/issues/123
 * Reported case: next execution time is set improperly
 * Potential duplicate: https://github.com/jmrozanec/cron-utils/issues/124
 */
@Test
public void testNextExecutionTimeProperlySet() {
    final CronParser quartzCronParser = new CronParser(CronDefinitionBuilder.instanceDefinitionFor(QUARTZ));
    final String quartzCronExpression2 = "0 5/15 * * * ? *";
    final Cron parsedQuartzCronExpression = quartzCronParser.parse(quartzCronExpression2);

    final ExecutionTime executionTime = ExecutionTime.forCron(parsedQuartzCronExpression);

    final ZonedDateTime zonedDateTime = LocalDateTime.of(2016, 7, 30, 15, 0, 0, 527).atZone(ZoneOffset.UTC);
    final Optional<ZonedDateTime> nextExecution = executionTime.nextExecution(zonedDateTime);
    final Optional<ZonedDateTime> lastExecution = executionTime.lastExecution(zonedDateTime);
    if (nextExecution.isPresent() && lastExecution.isPresent()) {
        final ZonedDateTime nextExecutionTime = nextExecution.get();
        final ZonedDateTime lastExecutionTime = lastExecution.get();

        assertEquals("2016-07-30T14:50Z", lastExecutionTime.toString());
        assertEquals("2016-07-30T15:05Z", nextExecutionTime.toString());
    } else {
        fail(ASSERTED_EXECUTION_NOT_PRESENT);
    }
}
 
开发者ID:jmrozanec,项目名称:cron-utils,代码行数:28,代码来源:ExecutionTimeQuartzIntegrationTest.java


示例14: testEveryTwoMinRollsOverHour

import com.cronutils.model.Cron; //导入依赖的package包/类
/**
 * Issue #38: every 2 min schedule doesn't roll over to next hour.
 */
@Test
public void testEveryTwoMinRollsOverHour() {
    final CronDefinition cronDefinition = CronDefinitionBuilder.instanceDefinitionFor(CronType.UNIX);
    final Cron cron = new CronParser(cronDefinition).parse("*/2 * * * *");
    final ExecutionTime executionTime = ExecutionTime.forCron(cron);
    final ZonedDateTime time = ZonedDateTime.parse("2015-09-05T13:56:00.000-07:00");
    final Optional<ZonedDateTime> nextExecutionTime = executionTime.nextExecution(time);
    if (nextExecutionTime.isPresent()) {
        final ZonedDateTime next = nextExecutionTime.get();
        final Optional<ZonedDateTime> shouldBeInNextHourExecution = executionTime.nextExecution(next);
        if (shouldBeInNextHourExecution.isPresent()) {
            assertEquals(next.plusMinutes(2), shouldBeInNextHourExecution.get());
            return;
        }
    }
    fail("one of the asserted values was not present.");
}
 
开发者ID:jmrozanec,项目名称:cron-utils,代码行数:21,代码来源:ExecutionTimeUnixIntegrationTest.java


示例15: testMatchWorksAsExpectedForCustomCronsWhenPreviousOrNextOccurrenceIsMissing

import com.cronutils.model.Cron; //导入依赖的package包/类
/**
 * Issue #136: Bug exposed at PR #136
 * https://github.com/jmrozanec/cron-utils/pull/136
 * Reported case: when executing isMatch for a given range of dates,
 * if date is invalid, we get an exception, not a boolean as response.
 */
@Test
public void testMatchWorksAsExpectedForCustomCronsWhenPreviousOrNextOccurrenceIsMissing() {
    final CronDefinition cronDefinition = CronDefinitionBuilder.defineCron()
            .withDayOfMonth()
            .supportsL().supportsW()
            .and()
            .withMonth().and()
            .withYear()
            .and().instance();

    final CronParser parser = new CronParser(cronDefinition);
    final Cron cron = parser.parse("05 05 2004");
    final ExecutionTime executionTime = ExecutionTime.forCron(cron);
    ZonedDateTime start = ZonedDateTime.of(2004, 5, 5, 23, 55, 0, 0, ZoneId.of("UTC"));
    final ZonedDateTime end = ZonedDateTime.of(2004, 5, 6, 1, 0, 0, 0, ZoneId.of("UTC"));
    while (start.compareTo(end) < 0) {
        assertTrue(executionTime.isMatch(start) == (start.getDayOfMonth() == 5));
        start = start.plusMinutes(1);
    }
}
 
开发者ID:jmrozanec,项目名称:cron-utils,代码行数:27,代码来源:ExecutionTimeCustomDefinitionIntegrationTest.java


示例16: CentralDogmaMirror

import com.cronutils.model.Cron; //导入依赖的package包/类
CentralDogmaMirror(Cron schedule, MirrorDirection direction, MirrorCredential credential,
                   Repository localRepo, String localPath,
                   URI remoteRepoUri, String remoteProject, String remoteRepo, String remotePath) {
    // Central Dogma has no notion of 'branch', so we just pass null as a placeholder.
    super(schedule, direction, credential, localRepo, localPath, remoteRepoUri, remotePath, null);

    this.remoteProject = requireNonNull(remoteProject, "remoteProject");
    this.remoteRepo = requireNonNull(remoteRepo, "remoteRepo");
}
 
开发者ID:line,项目名称:centraldogma,代码行数:10,代码来源:CentralDogmaMirror.java


示例17: Mirror

import com.cronutils.model.Cron; //导入依赖的package包/类
protected Mirror(Cron schedule, MirrorDirection direction, MirrorCredential credential,
                 Repository localRepo, String localPath,
                 URI remoteRepoUri, String remotePath, @Nullable String remoteBranch) {

    this.schedule = requireNonNull(schedule, "schedule");
    this.direction = requireNonNull(direction, "direction");
    this.credential = requireNonNull(credential, "credential");
    this.localRepo = requireNonNull(localRepo, "localRepo");
    this.localPath = normalizePath(requireNonNull(localPath, "localPath"));
    this.remoteRepoUri = requireNonNull(remoteRepoUri, "remoteRepoUri");
    this.remotePath = normalizePath(requireNonNull(remotePath, "remotePath"));
    this.remoteBranch = remoteBranch;
}
 
开发者ID:line,项目名称:centraldogma,代码行数:14,代码来源:Mirror.java


示例18: parseQuartzCron

import com.cronutils.model.Cron; //导入依赖的package包/类
private static String parseQuartzCron(final String cron) {

        final CronDefinition cronDefinition = CronDefinitionBuilder.instanceDefinitionFor(CronType.CRON4J);
        //create a parser based on provided definition
        final com.cronutils.parser.CronParser parser = new com.cronutils.parser.CronParser(cronDefinition);
        final Cron cron4jCron = parser.parse(cron);
        cron4jCron.validate();

        // Migrate types
        final CronMapper cronMapper = CronMapper.fromCron4jToQuartz();
        final Cron quartzCron = cronMapper.map(cron4jCron);

        return quartzCron.asString();
    }
 
开发者ID:ftsakiris,项目名称:async-engine,代码行数:15,代码来源:ScheduledTaskService.java


示例19: initializeExecutionTime

import com.cronutils.model.Cron; //导入依赖的package包/类
private ExecutionTime initializeExecutionTime() {
    ExecutionTime executionTime = null;
    CronDefinition cronD =
            CronDefinitionBuilder.instanceDefinitionFor(CronType.UNIX);
    CronParser parser = new CronParser(cronD);
    Cron cron = parser.parse(cronString);
    executionTime = ExecutionTime.forCron(cron);
    return executionTime;
}
 
开发者ID:blacklabelops,项目名称:crow,代码行数:10,代码来源:CronUtilsExecutionTime.java


示例20: forCron

import com.cronutils.model.Cron; //导入依赖的package包/类
/**
 * Creates execution time for given Cron.
 *
 * @param cron - Cron instance
 * @return ExecutionTime instance
 */
public static ExecutionTime forCron(final Cron cron) {
    final Map<CronFieldName, CronField> fields = cron.retrieveFieldsAsMap();
    final ExecutionTimeBuilder executionTimeBuilder = new ExecutionTimeBuilder(cron.getCronDefinition());
    for (final CronFieldName name : CronFieldName.values()) {
        if (fields.get(name) != null) {
            switch (name) {
                case SECOND:
                    executionTimeBuilder.forSecondsMatching(fields.get(name));
                    break;
                case MINUTE:
                    executionTimeBuilder.forMinutesMatching(fields.get(name));
                    break;
                case HOUR:
                    executionTimeBuilder.forHoursMatching(fields.get(name));
                    break;
                case DAY_OF_WEEK:
                    executionTimeBuilder.forDaysOfWeekMatching(fields.get(name));
                    break;
                case DAY_OF_MONTH:
                    executionTimeBuilder.forDaysOfMonthMatching(fields.get(name));
                    break;
                case MONTH:
                    executionTimeBuilder.forMonthsMatching(fields.get(name));
                    break;
                case YEAR:
                    executionTimeBuilder.forYearsMatching(fields.get(name));
                    break;
                case DAY_OF_YEAR:
                    executionTimeBuilder.forDaysOfYearMatching(fields.get(name));
                    break;
                default:
                    break;
            }
        }
    }
    return executionTimeBuilder.build();
}
 
开发者ID:jmrozanec,项目名称:cron-utils,代码行数:44,代码来源:ExecutionTime.java



注:本文中的com.cronutils.model.Cron类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ACCESS3Response类代码示例发布时间:2022-05-22
下一篇:
Java SimpleClient类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap