当前位置: 首页>>代码示例>>Java>>正文


Java InvalidRelativeIntervalException类代码示例

本文整理汇总了Java中com.belladati.sdk.exception.interval.InvalidRelativeIntervalException的典型用法代码示例。如果您正苦于以下问题:Java InvalidRelativeIntervalException类的具体用法?Java InvalidRelativeIntervalException怎么用?Java InvalidRelativeIntervalException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


InvalidRelativeIntervalException类属于com.belladati.sdk.exception.interval包,在下文中一共展示了InvalidRelativeIntervalException类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: startAfterEndRelative

import com.belladati.sdk.exception.interval.InvalidRelativeIntervalException; //导入依赖的package包/类
/** start may not be greater than end in relative intervals */
public void startAfterEndRelative() {
	try {
		new RelativeInterval<IntervalUnit>(DateUnit.DAY, 10, -10);
		fail("did not throw exception");
	} catch (InvalidRelativeIntervalException e) {
		assertEquals(e.getIntervalUnit(), DateUnit.DAY);
		assertEquals((int) e.getStart(), 10);
		assertEquals((int) e.getEnd(), -10);
	}
}
 
开发者ID:BellaDati,项目名称:belladati-sdk-java,代码行数:12,代码来源:IntervalTest.java

示例2: RelativeInterval

import com.belladati.sdk.exception.interval.InvalidRelativeIntervalException; //导入依赖的package包/类
/**
 * Creates a new absolute interval.
 * 
 * @param intervalUnit the interval unit to use
 * @param start start of the interval, in interval units from the current
 *            date/time
 * @param end end of the interval, in interval units from the current
 *            date/time
 * @throws NullIntervalException if the unit is <tt>null</tt>
 * @throws InvalidAbsoluteIntervalException if the given start is after the
 *             given end
 */
public RelativeInterval(U intervalUnit, int start, int end) throws NullIntervalException, InvalidAbsoluteIntervalException {
	super(intervalUnit);
	if (start > end) {
		throw new InvalidRelativeIntervalException(intervalUnit, start, end);
	}
	this.start = start;
	this.end = end;
}
 
开发者ID:BellaDati,项目名称:belladati-sdk-api,代码行数:21,代码来源:RelativeInterval.java


注:本文中的com.belladati.sdk.exception.interval.InvalidRelativeIntervalException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。