com.codingapi.springboot.permission.db.template.SQLTemplateContext Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of springboot-starter-data-permission Show documentation
Show all versions of springboot-starter-data-permission Show documentation
springboot-starter-data-permission project for Spring Boot
package com.codingapi.springboot.permission.db.template;
import java.util.ArrayList;
import java.util.List;
/**
* @author lorne
* @since 1.0.0
*/
public class SQLTemplateContext {
private final List templates = new ArrayList<>();
private static SQLTemplateContext context;
private SQLTemplateContext() {
}
public static SQLTemplateContext getInstance() {
if(context==null){
synchronized (SQLTemplateContext.class){
if(context==null){
context = new SQLTemplateContext();
}
}
}
return context;
}
protected void addSQLTemplates(List sqlTemplateList){
templates.addAll(sqlTemplateList);
}
public SQLTemplate template(String driverName){
for(SQLTemplate template : templates){
if(template.match(driverName)){
return template;
}
}
return null;
}
}