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

gu.sql2java.TableManagerProviders Maven / Gradle / Ivy

There is a newer version: 5.2.0
Show newest version
package gu.sql2java;

import java.util.Iterator;
import java.util.ServiceConfigurationError;
import gu.sql2java.utils.SPIUtils;

/**
 * @author guyadong
 * @since 3.20.0
 */
public class TableManagerProviders {
	private static TableManagerProvider instance;

	private TableManagerProviders() {
	}
	/**
	 * SPI(Service Provider Interface)机制加载 {@link TableManagerProvider}所有实例
	 */
	private static void loadTableManagerProvider() {
		Iterator itor = SPIUtils.serviceLoaderOf(TableManagerProvider.class).iterator();
		if(itor.hasNext()){
			try {
				instance = itor.next();
			} catch (ServiceConfigurationError e) {
				// 实例初始化失败输出错误日志后继续循环
				SimpleLog.log(e.getMessage());
			}
		}
	}
	static {
		loadTableManagerProvider();
	}
	public static TableManagerProvider getInstance() {
		return instance;
	}
	
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy