package es.internna.spring.mvc.api.validation;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
import org.springframework.validation.Validator;
public class AbstractValidatorHolder implements ValidatorHolder
{
protected Set<Validator> validators = new HashSet<Validator>();
public void setValidators(Set<Validator> validators)
{
this.validators = validators;
}
public void addValidators(Collection<Validator> validators)
{
if (!validators.isEmpty()) this.validators.addAll(validators);
}
public void addValidator(Validator validator) {
if (validator != null) {
this.validators.add(validator);
}
}
public void addValidator(Object validator)
{
if (validator != null) {
if (Validator.class.isInstance(validator)) {
Validator val = (Validator) validator;
this.validators.add(val);
}
}
}
}