本文整理汇总了Java中net.fortuna.ical4j.model.property.ExDate.getDates方法的典型用法代码示例。如果您正苦于以下问题:Java ExDate.getDates方法的具体用法?Java ExDate.getDates怎么用?Java ExDate.getDates使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.fortuna.ical4j.model.property.ExDate
的用法示例。
在下文中一共展示了ExDate.getDates方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getRecurrenceExcludeDates
import net.fortuna.ical4j.model.property.ExDate; //导入方法依赖的package包/类
/**
* Create list with excluded dates based on the exclusion rule.
*
* @param recurrenceExc
* @return list with excluded dates
*/
private List<Date> getRecurrenceExcludeDates(final String recurrenceExc) {
final List<Date> recurExcDates = new ArrayList<Date>();
if (recurrenceExc != null && !recurrenceExc.equals("")) {
try {
final net.fortuna.ical4j.model.ParameterList pl = new net.fortuna.ical4j.model.ParameterList();
final ExDate exdate = new ExDate(pl, recurrenceExc);
final DateList dl = exdate.getDates();
for (final Object date : dl) {
final Date excDate = (Date) date;
recurExcDates.add(excDate);
}
} catch (final ParseException e) {
log.error("cannot restore recurrence exceptions", e);
}
}
return recurExcDates;
}
示例2: fixExDates
import net.fortuna.ical4j.model.property.ExDate; //导入方法依赖的package包/类
private void fixExDates(Component comp) throws Exception {
PropertyList<ExDate> exDates = comp.getProperties(Property.EXDATE);
List<Property> toAdd = new ArrayList<>();
List<Property> toRemove = new ArrayList<>();
for(ExDate exDate : exDates) {
// ical likes a single exdate
if(exDate.getDates().size()==1) {
continue;
}
// remove exdate with multiple dates
toRemove.add(exDate);
// create single dates instead
for(Date date : exDate.getDates()) {
ExDate singleEx = (ExDate) exDate.copy();
singleEx.getDates().clear();
singleEx.getDates().add(date);
toAdd.add(singleEx);
}
}
// remove exdates with multiple dates
comp.getProperties().removeAll(toRemove);
// Add all single exdates
comp.getProperties().addAll(toAdd);
}