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

io.yawp.driver.api.DriverFactory Maven / Gradle / Ivy

There is a newer version: 2.08alpha
Show newest version
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