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


Java InvalidAbsoluteIntervalException类代码示例

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


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

示例1: DateRangeOverwritePolicy

import com.belladati.sdk.exception.interval.InvalidAbsoluteIntervalException; //导入依赖的package包/类
private DateRangeOverwritePolicy(String attribute, Calendar start, Calendar end) {
	if (start != null && end != null && start.after(end)) {
		throw new InvalidAbsoluteIntervalException(DateUnit.DAY, start, end);
	}
	this.attribute = attribute;
	this.start = start == null ? null : start.getTimeInMillis();
	this.end = end == null ? null : end.getTimeInMillis();
}
 
开发者ID:BellaDati,项目名称:belladati-sdk-api,代码行数:9,代码来源:OverwritePolicy.java

示例2: dateFromBeforeTo

import com.belladati.sdk.exception.interval.InvalidAbsoluteIntervalException; //导入依赖的package包/类
/** date range with end before start */
@Test(expectedExceptions = InvalidAbsoluteIntervalException.class)
public void dateFromBeforeTo() {
	Calendar start = new GregorianCalendar(2012, 3, 18);
	Calendar end = new GregorianCalendar(2012, 3, 17);
	OverwritePolicy.byDateFromTo(attribute, start, end);
}
 
开发者ID:BellaDati,项目名称:belladati-sdk-java,代码行数:8,代码来源:OverwritePolicyTest.java

示例3: startAfterEndAbsolute

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

示例4: AbsoluteInterval

import com.belladati.sdk.exception.interval.InvalidAbsoluteIntervalException; //导入依赖的package包/类
/**
 * Creates a new absolute interval.
 * 
 * @param intervalUnit the interval unit to use, indicating date or time and
 *            the highest level of detail
 * @param start start of the interval, ignoring any parts more detailed than
 *            the interval unit
 * @param end end of the interval, ignoring any parts more detailed than the
 *            interval unit
 * @throws NullIntervalException if start, end, or unit are <tt>null</tt>
 * @throws InvalidAbsoluteIntervalException if the given start is after the
 *             given end
 */
public AbsoluteInterval(U intervalUnit, Calendar start, Calendar end)
	throws NullIntervalException, InvalidAbsoluteIntervalException {
	super(intervalUnit);
	if (start == null || end == null) {
		throw new NullIntervalException(intervalUnit, "Interval start and end may not be null");
	}
	if (start.compareTo(end) > 0) {
		throw new InvalidAbsoluteIntervalException(intervalUnit, start, end);
	}
	this.start = start.getTimeInMillis();
	this.end = end.getTimeInMillis();
}
 
开发者ID:BellaDati,项目名称:belladati-sdk-api,代码行数:26,代码来源:AbsoluteInterval.java

示例5: RelativeInterval

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