All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.nls.validation.WhitelistValidator Maven / Gradle / Ivy

There is a newer version: 1.0.14
Show newest version
package com.nls.validation;

import com.nls.util.Emails;

import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;
import java.util.List;

public class WhitelistValidator implements ConstraintValidator {

    public void initialize(Whitelist parameters) {
    }

    public boolean isValid(String object, ConstraintValidatorContext context) {
        List emails = Emails.asList(object);
        for (String email : emails) {
            if (!Emails.validDomainOrEmail(email)) {
                return false;
            }
        }
        return true;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy