cron表达式中文翻译,支持复杂格式,6-7位

本文详细解析了Java中cron表达式的用法,包括6-7位的复杂格式,帮助读者掌握调度任务的时间设定。
摘要由CSDN通过智能技术生成
package com.gildata.qmp.dataverify.common.util;

import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.core.util.CronExpression;

import java.text.ParseException;

/**
 * cron表达式工具类
 */
public class CronUtils {

    private static final Integer SECOND = 0;
    private static final Integer MINUTE = 1;
    private static final Integer HOUR = 2;
    private static final Integer DAY = 3;
    private static final Integer MON = 4;
    private static final Integer WEEK = 5;
    private static final Integer YEAR = 6;

    private static final String WILDCARD_1 = "*";
    private static final String WILDCARD_2 = "-";
    private static final String WILDCARD_3 = "/";
    private static final String WILDCARD_4 = "?";
    private static final String WILDCARD_5 = "W";
    private static final String WILDCARD_6 = "L";
    private static final String WILDCARD_7 = "、";


    private static final Integer LENGTH = 6;

    public static String translateToChinese(String cronExp) {
        if (cronExp == null || cronExp.length() < 1) {
            return "cron表达式为空";
        }
        CronExpression exp;
        // 初始化cro
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值