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

com.codingapi.springboot.permission.db.template.SQLTemplateContext Maven / Gradle / Ivy

There is a newer version: 1.4.0
Show newest version
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;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy