io.inisos.bank4j.validator.constraintvalidators.BICValidator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bank4j Show documentation
Show all versions of bank4j Show documentation
Generates ISO 20022 XML Transfers and provides IBAN and BIC validation
package io.inisos.bank4j.validator.constraintvalidators;
import io.inisos.bank4j.validator.constraints.BIC;
import org.iban4j.BicUtil;
import org.iban4j.Iban4jException;
import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;
public class BICValidator implements ConstraintValidator {
@Override
public boolean isValid(String value, ConstraintValidatorContext constraintValidatorContext) {
if (value != null && value.length() != 0) {
try {
BicUtil.validate(value);
return true;
} catch (Iban4jException e) {
return false;
}
} else {
return true;
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy