/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.demo;

import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;

/**
 *
 * @author Administrator
 */
public class NotEmptyValidator implements ConstraintValidator<NotEmpty, String> {

    @Override
    public void initialize(NotEmpty constraintAnnotation) {
        
    }

    @Override
    public boolean isValid(String value, ConstraintValidatorContext context) {
        if (value == null) {
            return false;
        } else if (value.length() < 1) {
            return false;
        } else {
            return true;
        }

    }
}
