Example usage for org.joda.time Instant isEqualNow

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

Introduction

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

Prototype

public boolean isEqualNow() 

Source Link

Document

Is this instant equal to 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/*from  w  ww  . j a va2s. c o  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());
}