Class AbstractValueParser

java.lang.Object
org.aoju.bus.cron.pattern.parser.AbstractValueParser
All Implemented Interfaces:
ValueParser
Direct Known Subclasses:
DayOfMonthValueParser, DayOfWeekValueParser, HourValueParser, MinuteValueParser, MonthValueParser, YearValueParser

public abstract class AbstractValueParser extends Object implements ValueParser
简易值转换器将给定String值转为int,并限定最大值和最小值 此类同时识别L 为最大值
Since:
Java 17+
Version:
6.5.0
Author:
Kimi Liu
  • Field Details

    • min

      protected int min
      最小值(包括)
    • max

      protected int max
      最大值(包括)
  • Constructor Details

    • AbstractValueParser

      public AbstractValueParser(int min, int max)
      构造
      Parameters:
      min - 最小值(包括)
      max - 最大值(包括)
  • Method Details

    • parse

      public int parse(String value) throws org.aoju.bus.core.lang.exception.CrontabException
      Description copied from interface: ValueParser
      处理String值并转为int 转换包括:
      1. 数字字符串转为数字
      2. 别名转为对应的数字(如月份和星期)
      Specified by:
      parse in interface ValueParser
      Parameters:
      value - String值
      Returns:
      int
      Throws:
      org.aoju.bus.core.lang.exception.CrontabException
    • getMin

      public int getMin()
      Description copied from interface: ValueParser
      返回最小值
      Specified by:
      getMin in interface ValueParser
      Returns:
      最小值
    • getMax

      public int getMax()
      Description copied from interface: ValueParser
      返回最大值
      Specified by:
      getMax in interface ValueParser
      Returns:
      最大值
    • parseAsValueMatcher

      public ValueMatcher parseAsValueMatcher(String value)
      处理定时任务表达式每个时间字段 多个时间使用逗号分隔
      Specified by:
      parseAsValueMatcher in interface ValueParser
      Parameters:
      value - 某个时间字段
      Returns:
      the list
    • buildValueMatcher

      protected ValueMatcher buildValueMatcher(List<Integer> values)
      根据解析的数字值列表构建ValueMatcher 默认为BoolArrayValueMatcher,如果有特殊实现,子类须重写此方法
      Parameters:
      values - 数字值列表
      Returns:
      ValueMatcher