本文整理汇总了Java中org.joda.time.ReadableDateTime.isBefore方法的典型用法代码示例。如果您正苦于以下问题:Java ReadableDateTime.isBefore方法的具体用法?Java ReadableDateTime.isBefore怎么用?Java ReadableDateTime.isBefore使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.joda.time.ReadableDateTime
的用法示例。
在下文中一共展示了ReadableDateTime.isBefore方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getInstance
import org.joda.time.ReadableDateTime; //导入方法依赖的package包/类
/**
* Wraps another chronology, with datetime limits. When withUTC or
* withZone is called, the returned LimitChronology instance has
* the same limits, except they are time zone adjusted.
*
* @param base base chronology to wrap
* @param lowerLimit inclusive lower limit, or null if none
* @param upperLimit exclusive upper limit, or null if none
* @throws IllegalArgumentException if chronology is null or limits are invalid
*/
public static LimitChronology getInstance(Chronology base,
ReadableDateTime lowerLimit,
ReadableDateTime upperLimit) {
if (base == null) {
throw new IllegalArgumentException("Must supply a chronology");
}
lowerLimit = lowerLimit == null ? null : lowerLimit.toDateTime();
upperLimit = upperLimit == null ? null : upperLimit.toDateTime();
if (lowerLimit != null && upperLimit != null) {
if (!lowerLimit.isBefore(upperLimit)) {
throw new IllegalArgumentException
("The lower limit must be come before than the upper limit");
}
}
return new LimitChronology(base, (DateTime)lowerLimit, (DateTime)upperLimit);
}