本文整理汇总了Java中nl.siegmann.epublib.domain.Date类的典型用法代码示例。如果您正苦于以下问题:Java Date类的具体用法?Java Date怎么用?Java Date使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Date类属于nl.siegmann.epublib.domain包,在下文中一共展示了Date类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getFirstBookDate
import nl.siegmann.epublib.domain.Date; //导入依赖的package包/类
/**
* Get the first non-empty {@link nl.siegmann.epublib.domain.Date} from the given {@link Book}.
* @param book Book.
* @param type {@link nl.siegmann.epublib.domain.Date.Event} type.
* @return Date string, or {@code null} if {@code book} is {@code null} or doesn't have a non-empty date of the
* given {@code type}.
*/
public static String getFirstBookDate(Book book, Date.Event type) {
if (book == null || book.getMetadata().getDates().isEmpty()) return null;
for (Date bookDate : book.getMetadata().getDates()) {
if (bookDate.getEvent() != type || bookDate.getValue().isEmpty()) continue;
return bookDate.getValue();
}
return null;
}
示例2: getPublishYear
import nl.siegmann.epublib.domain.Date; //导入依赖的package包/类
/**
* Get the ebook's publish year.
*
* @return The publish year in line-representation.
*/
private List<Line> getPublishYear() {
List<Line> publishYearList = new ArrayList<Line>();
if (!ebook.getMetadata().getDates().isEmpty()) {
for (Date dateItem : ebook.getMetadata().getDates()) {
if (dateItem.getEvent() != null
&& dateItem.getEvent().toString().toLowerCase().matches(PUBLICATION)) {
publishYearList.add(new EpubModuleLine(dateItem.getValue(), false));
break;
}
}
}
return publishYearList;
}