Package org.aoju.bus.cron.pattern.parser
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
简易值转换器将给定String值转为int,并限定最大值和最小值
此类同时识别
L 为最大值- Since:
- Java 17+
- Version:
- 6.5.0
- Author:
- Kimi Liu
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected ValueMatcherbuildValueMatcher(List<Integer> values) 根据解析的数字值列表构建ValueMatcher默认为BoolArrayValueMatcher,如果有特殊实现,子类须重写此方法intgetMax()返回最大值intgetMin()返回最小值int处理String值并转为int 转换包括: 数字字符串转为数字 别名转为对应的数字(如月份和星期)parseAsValueMatcher(String value) 处理定时任务表达式每个时间字段 多个时间使用逗号分隔
-
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
Description copied from interface:ValueParser处理String值并转为int 转换包括:- 数字字符串转为数字
- 别名转为对应的数字(如月份和星期)
- Specified by:
parsein interfaceValueParser- Parameters:
value- String值- Returns:
- int
- Throws:
org.aoju.bus.core.lang.exception.CrontabException
-
getMin
public int getMin()Description copied from interface:ValueParser返回最小值- Specified by:
getMinin interfaceValueParser- Returns:
- 最小值
-
getMax
public int getMax()Description copied from interface:ValueParser返回最大值- Specified by:
getMaxin interfaceValueParser- Returns:
- 最大值
-
parseAsValueMatcher
处理定时任务表达式每个时间字段 多个时间使用逗号分隔- Specified by:
parseAsValueMatcherin interfaceValueParser- Parameters:
value- 某个时间字段- Returns:
- the list
-
buildValueMatcher
根据解析的数字值列表构建ValueMatcher默认为BoolArrayValueMatcher,如果有特殊实现,子类须重写此方法- Parameters:
values- 数字值列表- Returns:
ValueMatcher
-