本文整理汇总了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();
}
示例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);
}
示例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);
}
}
示例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();
}
示例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;
}