本文整理汇总了Java中java.time.ZonedDateTime.isAfter方法的典型用法代码示例。如果您正苦于以下问题:Java ZonedDateTime.isAfter方法的具体用法?Java ZonedDateTime.isAfter怎么用?Java ZonedDateTime.isAfter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.time.ZonedDateTime
的用法示例。
在下文中一共展示了ZonedDateTime.isAfter方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isExpired
import java.time.ZonedDateTime; //导入方法依赖的package包/类
@Override
public boolean isExpired(final TicketState ticketState) {
final ZonedDateTime currentSystemTime = ZonedDateTime.now(ZoneOffset.UTC);
final ZonedDateTime creationTime = ticketState.getCreationTime();
// token has been used, check maxTimeToLive (hard window)
ZonedDateTime expirationTime = creationTime.plus(this.maxTimeToLiveInSeconds, ChronoUnit.SECONDS);
if (currentSystemTime.isAfter(expirationTime)) {
LOGGER.debug("Access token is expired because the time since creation is greater than maxTimeToLiveInSeconds");
return true;
}
// token is within hard window, check timeToKill (sliding window)
expirationTime = creationTime.plus(this.timeToKillInSeconds, ChronoUnit.SECONDS);
if (ticketState.getLastTimeUsed().isAfter(expirationTime)) {
LOGGER.debug("Access token is expired because the time since last use is greater than timeToKillInMilliseconds");
return true;
}
return false;
}
示例2: isExpired
import java.time.ZonedDateTime; //导入方法依赖的package包/类
@Override
public boolean isExpired(final TicketState ticketState) {
final ZonedDateTime currentSystemTime = ZonedDateTime.now(ZoneOffset.UTC);
final ZonedDateTime creationTime = ticketState.getCreationTime();
final ZonedDateTime lastTimeUsed = ticketState.getLastTimeUsed();
// Ticket has been used, check maxTimeToLive (hard window)
ZonedDateTime expirationTime = creationTime.plus(this.maxTimeToLiveInSeconds, ChronoUnit.SECONDS);
if (currentSystemTime.isAfter(expirationTime)) {
LOGGER.debug("Ticket is expired because the time since creation is greater than maxTimeToLiveInSeconds");
return true;
}
expirationTime = lastTimeUsed.plus(this.timeToKillInSeconds, ChronoUnit.SECONDS);
if (currentSystemTime.isAfter(expirationTime)) {
LOGGER.debug("Ticket is expired because the time since last use is greater than timeToKillInSeconds");
return true;
}
return false;
}
示例3: isExpired
import java.time.ZonedDateTime; //导入方法依赖的package包/类
@Override
public boolean isExpired(final TicketState ticketState) {
if (ticketState == null) {
LOGGER.debug("Ticket state is null for [{}]", this.getClass().getSimpleName());
return true;
}
final long countUses = ticketState.getCountOfUses();
if (countUses >= this.numberOfUses) {
LOGGER.debug("Ticket usage count [{}] is greater than or equal to [{}]", countUses, this.numberOfUses);
return true;
}
final ZonedDateTime systemTime = ZonedDateTime.now(ZoneOffset.UTC);
final ZonedDateTime lastTimeUsed = ticketState.getLastTimeUsed();
final ZonedDateTime expirationTime = lastTimeUsed.plus(this.timeToKillInSeconds, ChronoUnit.SECONDS);
if (systemTime.isAfter(expirationTime)) {
LOGGER.debug("Ticket has expired because the difference between current time [{}] "
+ "and ticket time [{}] is greater than or equal to [{}]", systemTime, lastTimeUsed,
this.timeToKillInSeconds);
return true;
}
return false;
}
示例4: RelatieGegevens
import java.time.ZonedDateTime; //导入方法依赖的package包/类
RelatieGegevens(final MetaAttribuut datumAanvangAttribuut) {
this.datumAanvang = datumAanvangAttribuut;
//zoek betrokkenheid op de persoon
betrokkenheidObject = datumAanvangAttribuut.getParentRecord().getParentGroep().getParentObject();
while (!betrokkenheidObject.getParentObject().getObjectElement().isVanType(ElementConstants.PERSOON)) {
betrokkenheidObject = betrokkenheidObject.getParentObject();
}
final ParentFirstModelVisitor parentFirstModelVisitor = new ParentFirstModelVisitor() {
@Override
protected void doVisit(final MetaObject object) {
if (!object.getObjectElement().isVanType(ElementConstants.BETROKKENHEID)) {
return;
}
final ZonedDateTime zonedDateTime = bepaalTijdstipRegistratieVanBetrokkenheid(object);
if (zonedDateTime != null && (laatsteTsReg == null || zonedDateTime.isAfter(laatsteTsReg))) {
laatsteTsReg = zonedDateTime;
}
}
};
parentFirstModelVisitor.visit(betrokkenheidObject);
}
示例5: add
import java.time.ZonedDateTime; //导入方法依赖的package包/类
public void add(EntryViewBase<?> view) {
if (entryViews == null) {
entryViews = new ArrayList<>();
}
entryViews.add(view);
Entry<?> entry = view.getEntry();
ZonedDateTime entryStartTime = entry.getStartAsZonedDateTime();
ZonedDateTime entryEndTime = entry.getEndAsZonedDateTime();
if (entry.isFullDay()) {
entryStartTime = entryStartTime.with(LocalTime.MIN);
entryEndTime = entryEndTime.with(LocalTime.MAX);
}
if (startTime == null || entryStartTime.isBefore(startTime)) {
startTime = entryStartTime;
}
if (endTime == null || entryEndTime.isAfter(endTime)) {
endTime = entryEndTime;
}
}
示例6: intersects
import java.time.ZonedDateTime; //导入方法依赖的package包/类
public boolean intersects(EntryViewBase<?> view) {
if (startTime == null) {
/*
* The first added activity initializes the cluster.
*/
return true;
}
Entry<?> entry = view.getEntry();
ZonedDateTime entryStartTime = entry.getStartAsZonedDateTime();
ZonedDateTime entryEndTime = entry.getEndAsZonedDateTime();
if (entry.isFullDay()) {
entryStartTime = entryStartTime.with(LocalTime.MIN);
entryEndTime = entryEndTime.with(LocalTime.MAX);
}
return entryStartTime.isBefore(endTime)
&& entryEndTime.isAfter(startTime);
}
示例7: testRangeOfZonedDateTimes
import java.time.ZonedDateTime; //导入方法依赖的package包/类
@Test(dataProvider = "ZonedDateTimeRanges")
public void testRangeOfZonedDateTimes(ZonedDateTime start, ZonedDateTime end, Duration step, boolean parallel) {
final boolean ascend = start.isBefore(end);
final Range<ZonedDateTime> range = Range.of(start, end, step, v -> v.getHour() == 6);
final Array<ZonedDateTime> array = range.toArray(parallel);
final ZonedDateTime first = array.first(v -> true).map(ArrayValue::getValue).get();
final ZonedDateTime last = array.last(v -> true).map(ArrayValue::getValue).get();
Assert.assertEquals(array.typeCode(), ArrayType.ZONED_DATETIME);
Assert.assertTrue(!array.style().isSparse());
Assert.assertEquals(range.start(), start, "The range start");
Assert.assertEquals(range.end(), end, "The range end");
int index = 0;
ZonedDateTime value = first;
while (ascend ? value.isBefore(last) : value.isAfter(last)) {
final ZonedDateTime actual = array.getValue(index);
Assert.assertEquals(actual, value, "Value matches at " + index);
Assert.assertTrue(ascend ? actual.compareTo(start) >= 0 && actual.isBefore(end) : actual.compareTo(start) <= 0 && actual.isAfter(end), "Value in bounds at " + index);
value = ascend ? value.plus(step) : value.minus(step);
while (value.getHour() == 6) value = ascend ? value.plus(step) : value.minus(step);
index++;
}
}
示例8: updateLastRetrievedDocument
import java.time.ZonedDateTime; //导入方法依赖的package包/类
public void updateLastRetrievedDocument(String product, ZonedDateTime aDate) {
ZonedDateTime last = lastRetrievedDocuments.get(product);
if ((last == null) || aDate.isAfter(last)) {
lastRetrievedDocuments.put(product, aDate);
}
}
示例9: isGeldig
import java.time.ZonedDateTime; //导入方法依赖的package包/类
private boolean isGeldig(final MetaRecord metaRecord) {
final boolean recordTonenObvDatumEindeGeldigheid =
metaRecord.getDatumEindeGeldigheid() == null
|| (!datumAanvang.equals(metaRecord.getDatumEindeGeldigheid())
&& DatumUtil.valtDatumBinnenPeriode(metaRecord.getDatumEindeGeldigheid(), datumAanvang, null));
final ZonedDateTime datumTijdVerval = metaRecord.getDatumTijdVervalAttribuut();
final boolean recordTonenObvDatumTijdVerval = datumTijdVerval == null
|| Boolean.TRUE.equals(metaRecord.isIndicatieTbvLeveringMutaties()) || datumTijdVerval.isAfter(tijdstipRegistratie);
return recordTonenObvDatumEindeGeldigheid && recordTonenObvDatumTijdVerval;
}
示例10: formeelGeldig
import java.time.ZonedDateTime; //导入方法依赖的package包/类
/**
* @param registratieDatumTijd registratieDatumTijd
* @param vervalDatumTijd vervalDatumTijd
* @param historieVorm historieVorm
* @param formeelPeilmoment formeelPeilmoment
* @return geldig
*/
static boolean formeelGeldig(final ZonedDateTime registratieDatumTijd, final ZonedDateTime vervalDatumTijd,
final HistorieVorm historieVorm, final ZonedDateTime formeelPeilmoment) {
// Het record is formeel akkoord als de registratiedatum op of voor het peilmoment liggen
// (oftewel het peilmoment na de registratiedatum).
boolean formeleHistorieAkkoord = formeelPeilmoment.isAfter(registratieDatumTijd);
// Als we te maken hebben met niet actuele formele historie (record is vervallen)
// en tov het peilmoment in het verleden ligt, dan moet de historievorm inclusief formele historie zijn.
if (vervalDatumTijd != null && formeelPeilmoment.isAfter(vervalDatumTijd)) {
formeleHistorieAkkoord &= historieVorm == HistorieVorm.MATERIEEL_FORMEEL;
}
return formeleHistorieAkkoord;
}
示例11: getSplitBeginIndexes
import java.time.ZonedDateTime; //导入方法依赖的package包/类
/**
* Builds a list of split indexes from splitDuration.
* @param series the time series to get split begin indexes of
* @param splitDuration the duration between 2 splits
* @return a list of begin indexes after split
*/
public static List<Integer> getSplitBeginIndexes(TimeSeries series, Duration splitDuration) {
ArrayList<Integer> beginIndexes = new ArrayList<>();
int beginIndex = series.getBeginIndex();
int endIndex = series.getEndIndex();
// Adding the first begin index
beginIndexes.add(beginIndex);
// Building the first interval before next split
ZonedDateTime beginInterval = series.getFirstTick().getEndTime();
ZonedDateTime endInterval = beginInterval.plus(splitDuration);
for (int i = beginIndex; i <= endIndex; i++) {
// For each tick...
ZonedDateTime tickTime = series.getTick(i).getEndTime();
if (tickTime.isBefore(beginInterval) || !tickTime.isBefore(endInterval)) {
// Tick out of the interval
if (!endInterval.isAfter(tickTime)) {
// Tick after the interval
// --> Adding a new begin index
beginIndexes.add(i);
}
// Building the new interval before next split
beginInterval = endInterval.isBefore(tickTime) ? tickTime : endInterval;
endInterval = beginInterval.plus(splitDuration);
}
}
return beginIndexes;
}
示例12: intersect
import java.time.ZonedDateTime; //导入方法依赖的package包/类
public static boolean intersect(ZonedDateTime aStart, ZonedDateTime aEnd,
ZonedDateTime bStart, ZonedDateTime bEnd) {
// Same start time or same end time?
if (aStart.equals(bStart) || aEnd.equals(bEnd)) {
return true;
}
return aStart.isBefore(bEnd) && aEnd.isAfter(bStart);
}
示例13: validateBetList
import java.time.ZonedDateTime; //导入方法依赖的package包/类
private static void validateBetList(Parameter parameter) throws PinnacleException {
Validator validator = new Validator(parameter);
validator.addRequiredKey("betlist");
validator.addRequiredKey("fromDate");
validator.addRequiredKey("toDate");
validator.validateKeys();
ZonedDateTime from = ZonedDateTime.parse((String) validator.getValue("fromDate"));
ZonedDateTime to = ZonedDateTime.parse((String) validator.getValue("toDate"));
if (to.isAfter(from.plusDays(30)) || !to.isAfter(from)) {
throw PinnacleException.parameterInvalid(
"fromDate must be earlier than toDate and the difference between them must be less than 30 days.");
}
}
示例14: analyzeResourceList
import java.time.ZonedDateTime; //导入方法依赖的package包/类
private void analyzeResourceList(Result<Urlset> usResult) {
Urlset resourcelist = usResult.getContent().orElse(null);
ZonedDateTime listAt;
// ultimate date for resourceLists is in required md:at attribute
Optional<ZonedDateTime> maybeListAt = resourcelist.getMetadata().getAt();
if (maybeListAt.isPresent()) {
listAt = maybeListAt.get();
if (listAt.isAfter(ultimateResourceListAt)) ultimateResourceListAt = listAt;
} else {
usResult.addError(new RemoteResourceSyncFrameworkException("Missing required md:at attribute on resourceList"));
errorResults.add(usResult);
logger.warn("Missing required md:at attribute on resourceList at {}", usResult);
return;
}
Optional<ZonedDateTime> maybeListCompletedAt = resourcelist.getMetadata().getCompleted();
ZonedDateTime rlDate = maybeListCompletedAt.orElse(listAt);
if( rlDate.isAfter(getAsOfDateTime()) ){
countResourceLists++;
// walk item list
for (UrlItem item : resourcelist.getItemList()) {
countRemain++;
// set rs:at on item if not present
Optional<ZonedDateTime> maybeAt = item.getMetadata().flatMap(RsMd::getAt);
if (!maybeAt.isPresent()) item.getMetadata().map(rsMd1 -> rsMd1.withAt(listAt));
// merge item with recentItems
mergeItem(usResult, item);
}
} else {
logger.debug("Skipping resourceList because completed date {} <= {}: {}", listAt, getAsOfDateTime(), usResult);
}
}
示例15: test_isAfter_null
import java.time.ZonedDateTime; //导入方法依赖的package包/类
@Test(expectedExceptions=NullPointerException.class)
public void test_isAfter_null() {
ZonedDateTime a = ZonedDateTime.of(2008, 6, 30, 23, 30, 59, 0, ZONE_0100);
a.isAfter(null);
}