1 /*
2  * Hibernate Validator, declare and validate application constraints
3  *
4  * License: Apache License, Version 2.0
5  * See the license.txt file in the root directory or <http://www.apache.org/licenses/LICENSE-2.0>.
6  */

7 package org.hibernate.validator.internal.constraintvalidators.bv;
8
9 import javax.validation.ConstraintValidator;
10 import javax.validation.ConstraintValidatorContext;
11 import javax.validation.constraints.NotNull;
12
13 /**
14  * Validate that the object is not {@code null}.
15  *
16  * @author Emmanuel Bernard
17  */

18 public class NotNullValidator implements ConstraintValidator<NotNull, Object> {
19
20     @Override
21     public boolean isValid(Object object, ConstraintValidatorContext constraintValidatorContext) {
22         return object != null;
23     }
24 }
25