本文整理了Java中java.time.OffsetDateTime.isBefore()
方法的一些代码示例,展示了OffsetDateTime.isBefore()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。OffsetDateTime.isBefore()
方法的具体详情如下:
包路径:java.time.OffsetDateTime
类名称:OffsetDateTime
方法名:isBefore
[英]Checks if the instant of this date-time is before that of the specified date-time.
This method differs from the comparison in #compareTo in that it only compares the instant of the date-time. This is equivalent to using dateTime1.toInstant().isBefore(dateTime2.toInstant());.
[中]检查此日期时间的瞬间是否早于指定日期时间。
这种方法不同于#compare to中的比较,因为它只比较日期和时间的瞬间。这相当于使用dateTime1。toInstant()。isBefore(dateTime2.toInstant());。
代码示例来源:origin: prontera/spring-cloud-rest-tcc
/**
* 直接向服务查询, 不再自作聪明地在本地进行过期时间检查, 以免无法区分not found与conflict
*/
@Deprecated
private void checkExpireInLocal(TccRequest request, List<Participant> participantLinks) {
// 获取最接近过期的时间
final OffsetDateTime theClosestToExpire = fetchTheRecentlyExpireTime(participantLinks);
if (theClosestToExpire.minusSeconds(LEEWAY).isBefore(OffsetDateTime.now())) {
// 释放全部资源
cancel(request);
throw new ReservationAlmostToExpireException("there are resources be about to expire at " + theClosestToExpire);
}
}
代码示例来源:origin: org.assertj/assertj-core
/**
* Verifies that the actual {@code OffsetDateTime} is after or equals to the given one.
* <p>
* Example :
* <pre><code class='java'> assertThat(parse("2000-01-01T00:00:00Z")).isAfterOrEqualTo(parse("2000-01-01T00:00:00Z"))
* .isAfterOrEqualTo(parse("1999-12-31T23:59:59Z"));</code></pre>
*
* @param other the given {@link java.time.OffsetDateTime}.
* @return this assertion object.
* @throws AssertionError if the actual {@code OffsetDateTime} is {@code null}.
* @throws IllegalArgumentException if other {@code OffsetDateTime} is {@code null}.
* @throws AssertionError if the actual {@code OffsetDateTime} is not after or equals to the given one.
*/
public SELF isAfterOrEqualTo(OffsetDateTime other) {
Objects.instance().assertNotNull(info, actual);
assertOffsetDateTimeParameterIsNotNull(other);
if (actual.isBefore(other)) {
throw Failures.instance().failure(info, shouldBeAfterOrEqualsTo(actual, other));
}
return myself;
}
代码示例来源:origin: org.assertj/assertj-core
/**
* Verifies that the actual {@code OffsetDateTime} is <b>strictly</b> before the given one.
* <p>
* Example :
* <pre><code class='java'> assertThat(parse("2000-01-01T23:59:59Z")).isBefore(parse("2000-01-02T00:00:00Z"));</code></pre>
*
* @param other the given {@link java.time.OffsetDateTime}.
* @return this assertion object.
* @throws AssertionError if the actual {@code OffsetDateTime} is {@code null}.
* @throws IllegalArgumentException if other {@code OffsetDateTime} is {@code null}.
* @throws AssertionError if the actual {@code OffsetDateTime} is not strictly before the given one.
*/
public SELF isBefore(OffsetDateTime other) {
Objects.instance().assertNotNull(info, actual);
assertOffsetDateTimeParameterIsNotNull(other);
if (!actual.isBefore(other)) {
throw Failures.instance().failure(info, shouldBeBefore(actual, other));
}
return myself;
}
代码示例来源:origin: joel-costigliola/assertj-core
/**
* Verifies that the actual {@code OffsetDateTime} is <b>strictly</b> before the given one.
* <p>
* Example :
* <pre><code class='java'> assertThat(parse("2000-01-01T23:59:59Z")).isBefore(parse("2000-01-02T00:00:00Z"));</code></pre>
*
* @param other the given {@link java.time.OffsetDateTime}.
* @return this assertion object.
* @throws AssertionError if the actual {@code OffsetDateTime} is {@code null}.
* @throws IllegalArgumentException if other {@code OffsetDateTime} is {@code null}.
* @throws AssertionError if the actual {@code OffsetDateTime} is not strictly before the given one.
*/
public SELF isBefore(OffsetDateTime other) {
Objects.instance().assertNotNull(info, actual);
assertOffsetDateTimeParameterIsNotNull(other);
if (!actual.isBefore(other)) {
throw Failures.instance().failure(info, shouldBeBefore(actual, other));
}
return myself;
}
代码示例来源:origin: joel-costigliola/assertj-core
/**
* Verifies that the actual {@code OffsetDateTime} is after or equals to the given one.
* <p>
* Example :
* <pre><code class='java'> assertThat(parse("2000-01-01T00:00:00Z")).isAfterOrEqualTo(parse("2000-01-01T00:00:00Z"))
* .isAfterOrEqualTo(parse("1999-12-31T23:59:59Z"));</code></pre>
*
* @param other the given {@link java.time.OffsetDateTime}.
* @return this assertion object.
* @throws AssertionError if the actual {@code OffsetDateTime} is {@code null}.
* @throws IllegalArgumentException if other {@code OffsetDateTime} is {@code null}.
* @throws AssertionError if the actual {@code OffsetDateTime} is not after or equals to the given one.
*/
public SELF isAfterOrEqualTo(OffsetDateTime other) {
Objects.instance().assertNotNull(info, actual);
assertOffsetDateTimeParameterIsNotNull(other);
if (actual.isBefore(other)) {
throw Failures.instance().failure(info, shouldBeAfterOrEqualsTo(actual, other));
}
return myself;
}
代码示例来源:origin: de.adorsys.psd2/consent-management-lib
public boolean isBlockingExpired() {
return Optional.ofNullable(blockingExpirationTimestamp)
.map(timestamp -> timestamp.isBefore(OffsetDateTime.now()))
.orElse(false);
}
}
代码示例来源:origin: adorsys/xs2a
public boolean isBlockingExpired() {
return Optional.ofNullable(blockingExpirationTimestamp)
.map(timestamp -> timestamp.isBefore(OffsetDateTime.now()))
.orElse(false);
}
}
代码示例来源:origin: openmhealth/schemas
public static TimeInterval ofStartDateTimeAndEndDateTime(OffsetDateTime startDateTime, OffsetDateTime endDateTime) {
checkNotNull(startDateTime, "A start date time hasn't been specified.");
checkNotNull(endDateTime, "An end date time hasn't been specified.");
checkArgument(!endDateTime.isBefore(startDateTime), "The specified start and end date times are reversed.");
TimeInterval timeInterval = new TimeInterval();
timeInterval.startDateTime = startDateTime;
timeInterval.endDateTime = endDateTime;
return timeInterval;
}
代码示例来源:origin: otto-de/edison-microservice
@Override
public List<JobInfo> findRunningWithoutUpdateSince(OffsetDateTime timeOffset) {
return jobs.values().stream()
.filter(jobInfo -> !jobInfo.isStopped() && jobInfo.getLastUpdated().isBefore(timeOffset))
.collect(toList());
}
代码示例来源:origin: RoboZonky/robozonky
private static boolean isActionable(final LoanDescriptor loanDescriptor) {
final OffsetDateTime now = DateUtil.offsetNow();
return loanDescriptor.getLoanCaptchaProtectionEndDateTime()
.map(d -> d.isBefore(now))
.orElse(true);
}
代码示例来源:origin: com.github.robozonky/robozonky-app
private static boolean isActionable(final LoanDescriptor loanDescriptor) {
final OffsetDateTime now = DateUtil.offsetNow();
return loanDescriptor.getLoanCaptchaProtectionEndDateTime()
.map(d -> d.isBefore(now))
.orElse(true);
}
代码示例来源:origin: Silverpeas/Silverpeas-Core
/**
* This reminder is schedulable if the triggering date is defined and is after now.
* @return true if the triggering date is after now, false otherwise.
*/
@Override
public boolean isSchedulable() {
final OffsetDateTime triggeringDate = getDateTime();
return triggeringDate != null && !triggeringDate.isBefore(OffsetDateTime.now());
}
代码示例来源:origin: com.github.robozonky/robozonky-common
private static boolean isOutdated(final StateStorage storage, final String section,
final OffsetDateTime threshold) {
return storage.getValue(section, Constants.LAST_UPDATED_KEY.getValue())
.map(date -> OffsetDateTime.parse(date).isBefore(threshold))
.orElse(true);
}
代码示例来源:origin: RoboZonky/robozonky
private static boolean isOutdated(final StateStorage storage, final String section,
final OffsetDateTime threshold) {
return storage.getValue(section, Constants.LAST_UPDATED_KEY.getValue())
.map(date -> OffsetDateTime.parse(date).isBefore(threshold))
.orElse(true);
}
代码示例来源:origin: am.ik.blog/blog-domain
private boolean isOld(long amount, TemporalUnit unit) {
return this.value.plus(amount, unit) //
.isBefore(OffsetDateTime.now());
}
代码示例来源:origin: de.adorsys.psd2/consent-management-lib
public boolean isConfirmationExpired(long expirationPeriodMs) {
if (isNotConfirmed()) {
return creationTimestamp.plus(expirationPeriodMs, ChronoUnit.MILLIS)
.isBefore(OffsetDateTime.now());
}
return false;
}
代码示例来源:origin: de.adorsys.psd2/consent-management-lib
public boolean isConfirmationExpired(long expirationPeriodMs) {
if (isNotConfirmed()) {
return creationTimestamp.plus(expirationPeriodMs, ChronoUnit.MILLIS)
.isBefore(OffsetDateTime.now());
}
return false;
}
代码示例来源:origin: kiegroup/optaweb-employee-rostering
@JsonIgnore
public boolean isHistoric(OffsetDateTime dateTime) {
return dateTime.isBefore(OffsetDateTime.of(getFirstPublishedDate().atTime(LocalTime.MIDNIGHT), dateTime.getOffset()));
}
代码示例来源:origin: adorsys/xs2a
public boolean isConfirmationExpired(long expirationPeriodMs) {
if (isNotConfirmed()) {
return creationTimestamp.plus(expirationPeriodMs, ChronoUnit.MILLIS)
.isBefore(OffsetDateTime.now());
}
return false;
}
代码示例来源:origin: org.pageseeder.flint/pso-flint-lucene
private OffsetDateTime next(OffsetDateTime from, boolean forward) {
OffsetDateTime to;
if (forward) {
to = this._intervalDate == null ? from : from.plus(this._intervalDate);
to = this._intervalTime == null ? to : to.plus(this._intervalTime);
if (this._end != null && to.isAfter(this._end)) to = this._end;
} else {
to = this._intervalDate == null ? from : from.minus(this._intervalDate);
to = this._intervalTime == null ? to : to.minus(this._intervalTime);
if (this._end != null && to.isBefore(this._start)) to = this._start;
}
return to;
}
内容来源于网络,如有侵权,请联系作者删除!