Code example for Date

Methods: before

0
	} 
 
	public boolean isValid(Date value, ConstraintValidatorContext context) {
		Date now = GregorianCalendar.getInstance().getTime();
 
		if ( value.before( now ) ) {
			HibernateConstraintValidatorContext hibernateContext =
					context.unwrap( HibernateConstraintValidatorContext.class );
 
			hibernateContext.disableDefaultConstraintViolation();
			hibernateContext.addExpressionVariable( "now", now )
					.buildConstraintViolationWithTemplate( "Must be after ${now}" ) 
					.addConstraintViolation(); 
 
			return false; 
		} 
 
		return true; 
	} 
} 
Contextual code suggestions in your IDE  Get Codota for Java