本文整理汇总了Java中javax.xml.datatype.Duration.getTimeInMillis方法的典型用法代码示例。如果您正苦于以下问题:Java Duration.getTimeInMillis方法的具体用法?Java Duration.getTimeInMillis怎么用?Java Duration.getTimeInMillis使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.xml.datatype.Duration
的用法示例。
在下文中一共展示了Duration.getTimeInMillis方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: durationToTimespan
import javax.xml.datatype.Duration; //导入方法依赖的package包/类
/** @return kdb {@link Timespan} equivalent to XML duration */
public static Timespan durationToTimespan(Duration xmlDuration) {
if(xmlDuration == null)
return new Timespan(0l);
return new Timespan(NANO_SECONDS_IN_1_MS * xmlDuration.getTimeInMillis(DateTime.now().toDate()));
}
示例2: checkDurationGetTimeInMillisNeg
import javax.xml.datatype.Duration; //导入方法依赖的package包/类
@Test(expectedExceptions = NullPointerException.class)
public void checkDurationGetTimeInMillisNeg() {
Duration duration87 = datatypeFactory.newDuration("PT1M1S");
Calendar calendar87 = null;
duration87.getTimeInMillis(calendar87);
}
示例3: durationToLong
import javax.xml.datatype.Duration; //导入方法依赖的package包/类
/**
* Converts a lexical duration, as defined by XML Schema 1.0, into milliseconds.
*
* @param duration lexical duration representation
*
* @return duration in milliseconds
*/
public static long durationToLong(String duration) {
Duration xmlDuration = getDataTypeFactory().newDuration(duration);
return xmlDuration.getTimeInMillis(new GregorianCalendar());
}