本文整理汇总了Java中biweekly.util.Recurrence.Builder方法的典型用法代码示例。如果您正苦于以下问题:Java Recurrence.Builder方法的具体用法?Java Recurrence.Builder怎么用?Java Recurrence.Builder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类biweekly.util.Recurrence
的用法示例。
在下文中一共展示了Recurrence.Builder方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parseByDay
import biweekly.util.Recurrence; //导入方法依赖的package包/类
private void parseByDay(ListMultimap<String, String> rules, Recurrence.Builder builder, ParseContext context) {
Pattern p = Pattern.compile("^([-+]?\\d+)?(.*)$");
for (String value : rules.removeAll(BYDAY)) {
Matcher m = p.matcher(value);
if (!m.find()) {
//this should never happen
//the regex contains a "match-all" pattern and should never not find anything
context.addWarning(7, BYDAY, value);
continue;
}
String dayStr = m.group(2);
DayOfWeek day = DayOfWeek.valueOfAbbr(dayStr);
if (day == null) {
context.addWarning(7, BYDAY, value);
continue;
}
String prefixStr = m.group(1);
Integer prefix = (prefixStr == null) ? null : Integer.valueOf(prefixStr); //no need to catch NumberFormatException because the regex guarantees that it will be a number
builder.byDay(prefix, day);
}
}
示例2: parseTextV2
import biweekly.util.Recurrence; //导入方法依赖的package包/类
private T parseTextV2(String value, ICalDataType dataType, ICalParameters parameters, ParseContext context) {
Recurrence.Builder builder = new Recurrence.Builder((Frequency) null);
ListMultimap<String, String> rules = new ListMultimap<String, String>(VObjectPropertyValues.parseMultimap(value));
parseFreq(rules, builder, context);
parseUntil(rules, builder, context);
parseCount(rules, builder, context);
parseInterval(rules, builder, context);
parseBySecond(rules, builder, context);
parseByMinute(rules, builder, context);
parseByHour(rules, builder, context);
parseByDay(rules, builder, context);
parseByMonthDay(rules, builder, context);
parseByYearDay(rules, builder, context);
parseByWeekNo(rules, builder, context);
parseByMonth(rules, builder, context);
parseBySetPos(rules, builder, context);
parseWkst(rules, builder, context);
parseXRules(rules, builder); //must be called last
T property = newInstance(builder.build());
ICalDate until = property.getValue().getUntil();
if (until != null) {
context.addDate(until, property, parameters);
}
return property;
}
示例3: _parseJson
import biweekly.util.Recurrence; //导入方法依赖的package包/类
@Override
protected T _parseJson(JCalValue value, ICalDataType dataType, ICalParameters parameters, ParseContext context) {
Recurrence.Builder builder = new Recurrence.Builder((Frequency) null);
//upper-case the keys
ListMultimap<String, String> object = value.asObject();
ListMultimap<String, String> rules = new ListMultimap<String, String>(object.keySet().size());
for (Map.Entry<String, List<String>> entry : object) {
String key = entry.getKey().toUpperCase();
rules.putAll(key, entry.getValue());
}
parseFreq(rules, builder, context);
parseUntil(rules, builder, context);
parseCount(rules, builder, context);
parseInterval(rules, builder, context);
parseBySecond(rules, builder, context);
parseByMinute(rules, builder, context);
parseByHour(rules, builder, context);
parseByDay(rules, builder, context);
parseByMonthDay(rules, builder, context);
parseByYearDay(rules, builder, context);
parseByWeekNo(rules, builder, context);
parseByMonth(rules, builder, context);
parseBySetPos(rules, builder, context);
parseWkst(rules, builder, context);
parseXRules(rules, builder); //must be called last
T property = newInstance(builder.build());
ICalDate until = property.getValue().getUntil();
if (until != null) {
context.addDate(until, property, parameters);
}
return property;
}
示例4: parseFreq
import biweekly.util.Recurrence; //导入方法依赖的package包/类
private void parseFreq(ListMultimap<String, String> rules, final Recurrence.Builder builder, final ParseContext context) {
parseFirst(rules, FREQ, new Handler<String>() {
public void handle(String value) {
value = value.toUpperCase();
try {
builder.frequency(Frequency.valueOf(value));
} catch (IllegalArgumentException e) {
context.addWarning(7, FREQ, value);
}
}
});
}
示例5: parseUntil
import biweekly.util.Recurrence; //导入方法依赖的package包/类
private void parseUntil(ListMultimap<String, String> rules, final Recurrence.Builder builder, final ParseContext context) {
parseFirst(rules, UNTIL, new Handler<String>() {
public void handle(String value) {
try {
builder.until(date(value).parse());
} catch (IllegalArgumentException e) {
context.addWarning(7, UNTIL, value);
}
}
});
}
示例6: parseCount
import biweekly.util.Recurrence; //导入方法依赖的package包/类
private void parseCount(ListMultimap<String, String> rules, final Recurrence.Builder builder, final ParseContext context) {
parseFirst(rules, COUNT, new Handler<String>() {
public void handle(String value) {
try {
builder.count(Integer.valueOf(value));
} catch (NumberFormatException e) {
context.addWarning(7, COUNT, value);
}
}
});
}
示例7: parseInterval
import biweekly.util.Recurrence; //导入方法依赖的package包/类
private void parseInterval(ListMultimap<String, String> rules, final Recurrence.Builder builder, final ParseContext context) {
parseFirst(rules, INTERVAL, new Handler<String>() {
public void handle(String value) {
try {
builder.interval(Integer.valueOf(value));
} catch (NumberFormatException e) {
context.addWarning(7, INTERVAL, value);
}
}
});
}
示例8: parseBySecond
import biweekly.util.Recurrence; //导入方法依赖的package包/类
private void parseBySecond(ListMultimap<String, String> rules, final Recurrence.Builder builder, ParseContext context) {
parseIntegerList(BYSECOND, rules, context, new Handler<Integer>() {
public void handle(Integer value) {
builder.bySecond(value);
}
});
}
示例9: parseByMinute
import biweekly.util.Recurrence; //导入方法依赖的package包/类
private void parseByMinute(ListMultimap<String, String> rules, final Recurrence.Builder builder, ParseContext context) {
parseIntegerList(BYMINUTE, rules, context, new Handler<Integer>() {
public void handle(Integer value) {
builder.byMinute(value);
}
});
}
示例10: parseByHour
import biweekly.util.Recurrence; //导入方法依赖的package包/类
private void parseByHour(ListMultimap<String, String> rules, final Recurrence.Builder builder, ParseContext context) {
parseIntegerList(BYHOUR, rules, context, new Handler<Integer>() {
public void handle(Integer value) {
builder.byHour(value);
}
});
}
示例11: parseByMonthDay
import biweekly.util.Recurrence; //导入方法依赖的package包/类
private void parseByMonthDay(ListMultimap<String, String> rules, final Recurrence.Builder builder, ParseContext context) {
parseIntegerList(BYMONTHDAY, rules, context, new Handler<Integer>() {
public void handle(Integer value) {
builder.byMonthDay(value);
}
});
}
示例12: parseByYearDay
import biweekly.util.Recurrence; //导入方法依赖的package包/类
private void parseByYearDay(ListMultimap<String, String> rules, final Recurrence.Builder builder, ParseContext context) {
parseIntegerList(BYYEARDAY, rules, context, new Handler<Integer>() {
public void handle(Integer value) {
builder.byYearDay(value);
}
});
}
示例13: parseByWeekNo
import biweekly.util.Recurrence; //导入方法依赖的package包/类
private void parseByWeekNo(ListMultimap<String, String> rules, final Recurrence.Builder builder, ParseContext context) {
parseIntegerList(BYWEEKNO, rules, context, new Handler<Integer>() {
public void handle(Integer value) {
builder.byWeekNo(value);
}
});
}
示例14: parseByMonth
import biweekly.util.Recurrence; //导入方法依赖的package包/类
private void parseByMonth(ListMultimap<String, String> rules, final Recurrence.Builder builder, ParseContext context) {
parseIntegerList(BYMONTH, rules, context, new Handler<Integer>() {
public void handle(Integer value) {
builder.byMonth(value);
}
});
}
示例15: parseBySetPos
import biweekly.util.Recurrence; //导入方法依赖的package包/类
private void parseBySetPos(ListMultimap<String, String> rules, final Recurrence.Builder builder, ParseContext context) {
parseIntegerList(BYSETPOS, rules, context, new Handler<Integer>() {
public void handle(Integer value) {
builder.bySetPos(value);
}
});
}