View on GitHub

Cron-utils

Cron utils for parsing, validations and human readable descriptions.

Download this project as a .zip file Download this project as a tar.gz file

cron-utils

A Java library to parse, validate, migrate crons as well as get human readable descriptions for them. The project follows the Semantic Versioning Convention and uses Apache 2.0 license

Gitter Chat Build Status Coverage Status

Project stats by OpenHub

Download

cron-utils is available on Maven central repository.

<dependency>
    <groupId>com.cronutils</groupId>
    <artifactId>cron-utils</artifactId>
    <version>9.2.0</version>
</dependency>

Features

Quick example

//get a predefined instance
CronDefinition cronDefinition =
CronDefinitionBuilder.instanceDefinitionFor(QUARTZ);

//create a parser based on provided definition
CronParser parser = new CronParser(cronDefinition);
Cron quartzCron = parser.parse("0 * * 1-3 * ? *");

//create a descriptor for a specific Locale
CronDescriptor descriptor = CronDescriptor.instance(Locale.UK);

//parse some expression and ask descriptor for description
String description = descriptor.describe(parser.parse("*/45 * * * * ?"));
//description will be: "every 45 seconds"

//validate expression
quartzCron.validate()

For more examples, check our README and our examples repo

For stats about the project, you can visit our OpenHUB profile

Related projects