Example usage for org.joda.time Instant isBeforeNow

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

Introduction

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

Prototype

public boolean isBeforeNow() 

Source Link

Document

Is this instant strictly before 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   www.j av a  2  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());
}