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

io.github.stylesmile.mybatis.bean.MybatisConfig Maven / Gradle / Ivy

There is a newer version: 2.10.2
Show newest version
package io.github.stylesmile.mybatis.bean;

import org.apache.ibatis.plugin.Interceptor;
import org.apache.ibatis.session.SqlSessionFactory;

import javax.sql.DataSource;
import java.util.HashMap;
import java.util.Map;

/**
 * @author Stylesmile
 */
public class MybatisConfig {

    private Map dataSources;

    private String mapperLocations = "mapper";

    private Interceptor[] plugins;

    private Boolean mapUnderscoreToCamelCase = true;

//    private IdentifierGenerator identifierGenerator;

    public Boolean getMapUnderscoreToCamelCase() {
        return mapUnderscoreToCamelCase;
    }

    public void setMapUnderscoreToCamelCase(Boolean mapUnderscoreToCamelCase) {
        this.mapUnderscoreToCamelCase = mapUnderscoreToCamelCase;
    }

    public Interceptor[] getPlugins() {
        return plugins;
    }

    public void setPlugins(Interceptor[] plugins) {
        this.plugins = plugins;
    }

    public Map getDataSources() {
        return dataSources;
    }

    public void addDataSource(DataSource dataSource) {
        if (dataSources == null) {
            dataSources = new HashMap<>();
        }
        dataSources.put(SqlSessionFactory.class.getName(), dataSource);
    }

    public void addDataSource(String dataSourceName, DataSource dataSource) {
        if (dataSources == null) {
            dataSources = new HashMap<>();
        }
        dataSources.put(dataSourceName, dataSource);
    }

//    public IdentifierGenerator getIdentifierGenerator() {
//        return identifierGenerator;
//    }
//
//    public void setIdentifierGenerator(IdentifierGenerator identifierGenerator) {
//        this.identifierGenerator = identifierGenerator;
//    }

    public String getMapperLocations() {
        return mapperLocations;
    }

    public void setMapperLocations(String mapperLocations) {
        this.mapperLocations = mapperLocations;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy