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

com.dream.solon.bean.ConfigurationBean Maven / Gradle / Ivy

The newest version!
package com.dream.solon.bean;

import com.dream.drive.config.DefaultConfig;
import com.dream.system.config.Configuration;
import com.dream.system.mapper.DefaultMapperFactory;
import com.dream.system.table.factory.DefaultTableFactory;

import java.util.ArrayList;
import java.util.List;

public class ConfigurationBean {
    private List tablePackages = new ArrayList<>();
    private List mapperPackages = new ArrayList<>();

    public ConfigurationBean() {
        this(null, null);
    }

    public ConfigurationBean(List tablePackages, List mapperPackages) {
        this.addTablePackages(tablePackages);
        this.addMapperPackages(mapperPackages);
    }

    public void addTablePackages(List tablePackages) {
        if (tablePackages != null) {
            this.tablePackages.addAll(tablePackages);
        }
    }

    public void addMapperPackages(List mapperPackages) {
        if (mapperPackages != null) {
            this.mapperPackages.addAll(mapperPackages);
        }
    }

    public Configuration getObject() {
        DefaultConfig defaultConfig = defaultConfig(this.tablePackages, this.mapperPackages);
        return defaultConfig.toConfiguration();
    }


    protected DefaultConfig defaultConfig(List tablePackages, List mapperPackages) {
        DefaultConfig defaultConfig = new DefaultConfig();
        defaultConfig
                .setMapperFactory(new DefaultMapperFactory())
                .setTableFactory(new DefaultTableFactory());
        defaultConfig.setTablePackages(tablePackages);
        defaultConfig.setMapperPackages(mapperPackages);
        return defaultConfig;
    }
}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy