com.notronix.hibermate.api.Syncable Maven / Gradle / Ivy
package com.notronix.hibermate.api;
import java.time.Instant;
import java.time.temporal.TemporalUnit;
public interface Syncable
{
Instant getLastSynchronizedDate();
void setLastSynchronizedDate(Instant lastSynchronizedDate);
default boolean hasNotBeenUpdatedIn(long value, TemporalUnit unit) {
Instant date = getLastSynchronizedDate();
if (date == null) {
return true;
}
return date.isBefore(Instant.now().minus(value, unit));
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy