Example usage for org.joda.time ReadableInstant isEqual

List of usage examples for org.joda.time ReadableInstant isEqual

Introduction

In this page you can find the example usage for org.joda.time ReadableInstant isEqual.

Prototype

boolean isEqual(ReadableInstant instant);

Source Link

Document

Is this instant equal to the instant passed in comparing solely by millisecond.

Usage

From source file:com.alliander.osgp.domain.core.validation.joda.FutureValidator.java

License:Open Source License

@Override
public boolean isValid(final ReadableInstant value, final ConstraintValidatorContext context) {
    if (value == null) {
        return true;
    }/*w  w w. j a  va 2 s .  c  o  m*/

    final DateTime checkDate = new DateMidnight(DateTimeZone.UTC).toDateTime();

    return value.isEqual(checkDate) || value.isAfter(checkDate);
}

From source file:com.alliander.osgp.domain.core.validation.joda.PastValidator.java

License:Open Source License

@Override
public boolean isValid(final ReadableInstant value, final ConstraintValidatorContext context) {
    if (value == null) {
        return true;
    }//ww w. ja v  a 2s.  c o  m

    final DateMidnight checkDate = new DateMidnight(DateTimeZone.UTC);

    return value.isEqual(checkDate) || value.isBefore(checkDate);
}

From source file:com.robwilliamson.healthyesther.util.time.Range.java

License:Open Source License

@Override
public boolean contains(ReadableInstant instant, Comparison comparison) {
    if (instant.isAfter(from) && instant.isBefore(to)) {
        return true;
    }//ww  w. j  a  v a 2 s  .c  o m

    if (comparison == Comparison.EXCLUSIVE) {
        return false;
    }

    return instant.isEqual(from) || instant.isEqual(to);
}

From source file:com.robwilliamson.healthyesther.util.time.RangeSet.java

License:Open Source License

private static boolean afterOrEqualTo(ReadableInstant lhs, ReadableInstant rhs) {
    return lhs.isAfter(rhs) || lhs.isEqual(rhs);
}