src/org/nutz/dao/impl/NutDao.java
public void setExpert(Object obj) throws Exception {
        if (obj == null)
            throw new NullPointerException("expert MUST NOT NULL!!");
        if (obj instanceof JdbcExpert) {
            this.expert = (JdbcExpert) obj;
        } else {
            String name = obj.toString();
            this.expert = Jdbcs.getExpert(name, "");
            if (this.expert == null) {
                if (name.contains(".")) {
                    Class<?> klass = Lang.loadClass(name);
                    try {
                        this.expert = (JdbcExpert) Mirror.me(klass).born(Jdbcs.getConf());
                    }
                    catch (Throwable e) {
                        this.expert = (JdbcExpert) Mirror.me(klass).born();
                    }
                } else {
                    throw new DaoException("not such expert=" + obj);
                }
            }
        }
        DataSource ds = this.dataSource;
        // 如果数据源比expert先设置,那么需要重新设置一次
        if (ds != null) {
            this.dataSource = null;
            setDataSource(ds);
        }
    }
public void setExpert(Object obj) throws Exception {
        if (obj == null)
            throw new NullPointerException("expert MUST NOT NULL!!");
        if (obj instanceof JdbcExpert) {
            this.expert = (JdbcExpert) obj;
        } else {
            String name = obj.toString();
            this.expert = Jdbcs.getExpert(name, "");
            if (this.expert == null) {
                if (name.contains(".")) {
                    Class<?> klass = Lang.loadClass(name);
                    try {
                        this.expert = (JdbcExpert) Mirror.me(klass).born(Jdbcs.getConf());
                    }
                    catch (Throwable e) {
                        this.expert = (JdbcExpert) Mirror.me(klass).born();
                    }
                } else {
                    throw new DaoException("not such expert=" + obj);
                }
            }
        }
        DataSource ds = this.dataSource;
        // 如果数据源比expert先设置,那么需要重新设置一次
        if (ds != null) {
            this.dataSource = null;
            setDataSource(ds);
        }
    }
专属于NutDao的一些帮助方法