io.yawp.driver.api.DriverFactory Maven / Gradle / Ivy
package io.yawp.driver.api;
import io.yawp.repository.Repository;
import java.util.ServiceLoader;
public class DriverFactory {
public static Driver getDriver(Repository r) {
Driver driver = lookup();
driver.init(r);
return driver;
}
public static Driver getDriver() {
Driver driver = lookup();
return driver;
}
private static Driver lookup() {
ServiceLoader drivers = ServiceLoader.load(Driver.class);
for (Driver driver : drivers) {
return driver;
}
throw new RuntimeException("No yawp driver found!");
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy