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

fi.kapsi.killnine.iban.spi.IbanValidationService Maven / Gradle / Ivy

The newest version!
package fi.kapsi.killnine.iban.spi;

import java.util.ArrayList;
import java.util.List;
import java.util.ServiceLoader;

import fi.kapsi.killnine.iban.Iban;

/**
 * A service for acquiring IBAN validations. Uses ServiceLoader as a simple SPI mechanism.
 */
public class IbanValidationService {

    private static final ServiceLoader VALIDATION_LOADER = ServiceLoader.load(IbanValidation.class);

    /**
     * Gets configured validations capable of validating the given IBAN.
     * 
     * @param iban      IBAN to validate.
     * 
     * @return validations for validating the IBAN.
     */
    public List getValidations(Iban iban) {
        List validations = new ArrayList();
        for (IbanValidation validation : VALIDATION_LOADER) {
            if (validation.canValidate(iban)) {
                validations.add(validation);
            }
        }
        return validations;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy