/*
 * blancoDb
 * Copyright (C) 2004-2005 Yasuo Nakanishi
 * 
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 */
package blanco.db.util;

import blanco.db.conf.BlancoDbSetting;
import blanco.ig.expander.Type;

/**
 * @author Yasuo Nakanishi
 */
public class BlancoDbObjectStorage {
    private BlancoDbSetting _setting = null;

    public BlancoDbSetting getSetting() {
        return _setting;
    }

    public void setSetting(final BlancoDbSetting setting) {
        _setting = setting;
    }

    /**
     * パッケージ名の読替を行いながらTypeクラスのインスタンスを生成します。
     * 
     * @param type
     * @return
     */
    public Type createRuntime(final Class type) {
        String typeName = type.getName().replaceAll("blanco.db",
                _setting.getRootNameSpace());
        return new Type(typeName);
    }
}