Example usage for org.joda.time Instant isAfterNow

List of usage examples for org.joda.time Instant isAfterNow

Introduction

In this page you can find the example usage for org.joda.time Instant isAfterNow.

Prototype

public boolean isAfterNow() 

Source Link

Document

Is this instant strictly after the current instant comparing solely by millisecond.

Usage

From source file:dk.nsi.stamdata.cpr.PersonMapper.java

License:Mozilla Public License

private boolean isPersonProtected(Person person) {
    if (person.getNavnebeskyttelsestartdato() == null)
        return false;

    // We have to make the guard above to avoid null being passed into the
    // Instant/* w  w w .java2 s .  co  m*/
    // it is converted to the beginning of the era.

    Preconditions.checkState(person.getNavnebeskyttelseslettedato() != null,
            "The protection end date was not present. This is most unexpected and a programming error.");

    Instant protectionStart = new Instant(person.getNavnebeskyttelsestartdato());
    Instant protectionEnd = new Instant(person.getNavnebeskyttelseslettedato());

    return protectionStart.isEqualNow() || (protectionStart.isBeforeNow() && protectionEnd.isAfterNow());
}