当前位置: 首页>>代码示例>>Java>>正文


Java TableConfiguration.getTableName方法代码示例

本文整理汇总了Java中org.mybatis.generator.config.TableConfiguration.getTableName方法的典型用法代码示例。如果您正苦于以下问题:Java TableConfiguration.getTableName方法的具体用法?Java TableConfiguration.getTableName怎么用?Java TableConfiguration.getTableName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.mybatis.generator.config.TableConfiguration的用法示例。


在下文中一共展示了TableConfiguration.getTableName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: introspectNativeSQLTypes

import org.mybatis.generator.config.TableConfiguration; //导入方法依赖的package包/类
private void introspectNativeSQLTypes() {
    Connection conn = null;
    try {
        conn = getConnection();
        DatabaseMetaData dbmd = conn.getMetaData();
        for (TableConfiguration tc : context.getTableConfigurations()) {
            String tableName = tc.getTableName();
            Map<String, ColumnInfo> map = new HashMap<String, ColumnInfo>();
            columnInfo.put(tableName, map);

            TableName tn = new TableName(tc, dbmd);

            ResultSet rset = dbmd.getColumns(tn.catalog, tn.schema, tn.table, null);

            while (rset.next()) {
                ColumnInfo info = new ColumnInfo();
                map.put(rset.getString("COLUMN_NAME"), info);
                info.nativeTypeName = rset.getString("TYPE_NAME");
            }

            rset.close();
        }
    } catch (SQLException e) {
        e.printStackTrace();
    } finally {
        closeConnection(conn);
    }
}
 
开发者ID:vsl1978,项目名称:mybatis-generator-pluginsplus,代码行数:29,代码来源:JDBCTypesPlugin.java

示例2: TableName

import org.mybatis.generator.config.TableConfiguration; //导入方法依赖的package包/类
public TableName(TableConfiguration tc, DatabaseMetaData dbmd) throws SQLException {
    String localCatalog = tc.getCatalog();
    String localSchema = tc.getSchema();
    String localTableName = tc.getTableName();
    try {
        boolean delimitIdentifiers = tc.isDelimitIdentifiers() || Str.containsSpaces(localCatalog, localSchema, localTableName);
        if (!delimitIdentifiers && dbmd.storesLowerCaseIdentifiers()) {
            localCatalog = Str.lower(localCatalog);
            localSchema = Str.lower(localSchema);
            localTableName = Str.lower(localTableName);
        } else if (!delimitIdentifiers && dbmd.storesUpperCaseIdentifiers()) {
            localCatalog = Str.upper(localCatalog);
            localSchema = Str.upper(localSchema);
            localTableName = Str.upper(localTableName);
        }
        if (tc.isWildcardEscapingEnabled()) {
            String searchStringEscape = dbmd.getSearchStringEscape();
            localSchema = escape(localSchema, searchStringEscape);
            localTableName = escape(localTableName, searchStringEscape);
        }

    } finally {
        catalog = localCatalog;
        schema = localSchema;
        table = localTableName;
    }
}
 
开发者ID:vsl1978,项目名称:mybatis-generator-pluginsplus,代码行数:28,代码来源:IntrospectorPlugin.java

示例3: validate

import org.mybatis.generator.config.TableConfiguration; //导入方法依赖的package包/类
@Override
public boolean validate(List<String> strings) {
    String TABLES = "tables";
    String EXCLUDE_TABLES = "excludeTables";
    Pattern include = Pattern.compile(Objects.nvl(Str.trim(properties.getProperty(TABLES)), ".+"));
    Pattern exclude = Pattern.compile(Objects.nvl(Str.trim(properties.getProperty(EXCLUDE_TABLES)), "^-$"));
    for (TableConfiguration tc : context.getTableConfigurations()) {
        String tableName = tc.getTableName();
        if (!include.matcher(tableName).matches() || exclude.matcher(tableName).matches())
            continue;
        Set<String> set = modified.get(tableName);
        if (set == null)
            modified.put(tableName, set = new HashSet<String>());
        Properties p = tc.getProperties();
        for (Enumeration<?> e = properties.propertyNames(); e.hasMoreElements(); ) {
            String name = (String)e.nextElement();
            if (TABLES.equals(name) || EXCLUDE_TABLES.equals(name)) continue;

            String value = properties.getProperty(name);
            if ("alias".equals(name)) {
                if (Str.trim(tc.getAlias()) == null) {
                    tc.setAlias(value);
                    set.add(name);
                }
            }
            else if (!p.containsKey(name)) {
                p.setProperty(name, value);
                set.add(name);
            }
        }
    }
    return true;
}
 
开发者ID:vsl1978,项目名称:mybatis-generator-pluginsplus,代码行数:34,代码来源:CommonTablePropertiesPlugin.java


注:本文中的org.mybatis.generator.config.TableConfiguration.getTableName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。