當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。