本文整理汇总了Java中com.rometools.rome.feed.rss.Item.getEnclosures方法的典型用法代码示例。如果您正苦于以下问题:Java Item.getEnclosures方法的具体用法?Java Item.getEnclosures怎么用?Java Item.getEnclosures使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.rometools.rome.feed.rss.Item
的用法示例。
在下文中一共展示了Item.getEnclosures方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: populateItem
import com.rometools.rome.feed.rss.Item; //导入方法依赖的package包/类
@Override
protected void populateItem(final Item item, final Element eItem, final int index) {
super.populateItem(item, eItem, index);
final Source source = item.getSource();
if (source != null) {
eItem.addContent(generateSourceElement(source));
}
final List<Enclosure> enclosures = item.getEnclosures();
for (int i = 0; i < getNumberOfEnclosures(enclosures); i++) {
eItem.addContent(generateEnclosure(enclosures.get(i)));
}
final List<Category> categories = item.getCategories();
for (final Category category : categories) {
eItem.addContent(generateCategoryElement(category));
}
}
示例2: createSyndEntry
import com.rometools.rome.feed.rss.Item; //导入方法依赖的package包/类
@Override
protected SyndEntry createSyndEntry(final Item item, final boolean preserveWireItem) {
final SyndEntry syndEntry = super.createSyndEntry(item, preserveWireItem);
final List<Category> cats = item.getCategories();
if (!cats.isEmpty()) {
// using a set to remove duplicates and use a LinkedHashSet to try to retain the
// document order
final Set<SyndCategory> s = new LinkedHashSet<SyndCategory>();
// feed native categories (as syndcat)
s.addAll(createSyndCategories(cats));
// DC subjects (as syndcat)
s.addAll(syndEntry.getCategories());
syndEntry.setCategories(new ArrayList<SyndCategory>(s)); // c
}
final List<Enclosure> enclosures = item.getEnclosures();
if (!enclosures.isEmpty()) {
syndEntry.setEnclosures(createSyndEnclosures(enclosures));
}
return syndEntry;
}