Example usage for org.joda.time.base AbstractPartial toDateTime

List of usage examples for org.joda.time.base AbstractPartial toDateTime

Introduction

In this page you can find the example usage for org.joda.time.base AbstractPartial toDateTime.

Prototype

public DateTime toDateTime(ReadableInstant baseInstant) 

Source Link

Document

Resolves this partial against another complete instant to create a new full instant.

Usage

From source file:org.hibernate.validator.constraints.impl.FutureValidatorForAbstractPartial.java

License:Apache License

public boolean isValid(AbstractPartial value, ConstraintValidatorContext context) {
    //null values are valid
    if (value == null) {
        return true;
    }/*from  w w  w. j a v  a  2  s . c o m*/

    return value.toDateTime(null).isAfterNow();
}

From source file:org.hibernate.validator.constraints.impl.PastValidatorForAbstractPartial.java

License:Apache License

public boolean isValid(AbstractPartial value, ConstraintValidatorContext context) {
    //null values are valid
    if (value == null) {
        return true;
    }/*w  w w.  j av  a  2 s.  c  om*/

    return value.toDateTime(null).isBeforeNow();
}