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


Java TableConfiguration.isAllColumnDelimitingEnabled方法代码示例

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


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

示例1: calculateExtraColumnInformation

import org.mybatis.generator.config.TableConfiguration; //导入方法依赖的package包/类
private void calculateExtraColumnInformation(TableConfiguration tc,
        Map<ActualTableName, List<IntrospectedColumn>> columns) {
    StringBuilder sb = new StringBuilder();
    Pattern pattern = null;
    String replaceString = null;
    if (tc.getColumnRenamingRule() != null) {
        pattern = Pattern.compile(tc.getColumnRenamingRule().getSearchString());
        replaceString = tc.getColumnRenamingRule().getReplaceString();
        replaceString = replaceString == null ? "" : replaceString; //$NON-NLS-1$
    }

    for (Map.Entry<ActualTableName, List<IntrospectedColumn>> entry : columns.entrySet()) {
        for (IntrospectedColumn introspectedColumn : entry.getValue()) {
            String calculatedColumnName;
            if (pattern == null) {
                calculatedColumnName = introspectedColumn.getActualColumnName();
            } else {
                Matcher matcher = pattern.matcher(introspectedColumn.getActualColumnName());
                calculatedColumnName = matcher.replaceAll(replaceString);
            }

            if (isTrue(tc.getProperty(PropertyRegistry.TABLE_USE_ACTUAL_COLUMN_NAMES))) {
                introspectedColumn.setJavaProperty(getValidPropertyName(calculatedColumnName));
            } else if (isTrue(tc.getProperty(PropertyRegistry.TABLE_USE_COMPOUND_PROPERTY_NAMES))) {
                sb.setLength(0);
                sb.append(calculatedColumnName);
                sb.append('_');
                sb.append(getCamelCaseString(introspectedColumn.getRemarks(), true));
                introspectedColumn.setJavaProperty(getValidPropertyName(sb.toString()));
            } else {
                introspectedColumn.setJavaProperty(getCamelCaseString(calculatedColumnName, false));
            }

            FullyQualifiedJavaType fullyQualifiedJavaType = javaTypeResolver.calculateJavaType(introspectedColumn);

            if (fullyQualifiedJavaType != null) {
                introspectedColumn.setFullyQualifiedJavaType(fullyQualifiedJavaType);
                introspectedColumn.setJdbcTypeName(javaTypeResolver.calculateJdbcTypeName(introspectedColumn));
            }

            if (context.autoDelimitKeywords()) {
                if (SqlReservedWords.containsWord(introspectedColumn.getActualColumnName())) {
                    introspectedColumn.setColumnNameDelimited(true);
                }
            }

            if (tc.isAllColumnDelimitingEnabled()) {
                introspectedColumn.setColumnNameDelimited(true);
            }
        }
    }
}
 
开发者ID:funny5258,项目名称:autocode,代码行数:53,代码来源:DatabaseIntrospector.java

示例2: calculateExtraColumnInformation

import org.mybatis.generator.config.TableConfiguration; //导入方法依赖的package包/类
private void calculateExtraColumnInformation(TableConfiguration tc,
		Map<ActualTableName, List<IntrospectedColumn>> columns) {
	StringBuilder sb = new StringBuilder();
	Pattern pattern = null;
	String replaceString = null;
	if (tc.getColumnRenamingRule() != null) {
		pattern = Pattern.compile(tc.getColumnRenamingRule().getSearchString());
		replaceString = tc.getColumnRenamingRule().getReplaceString();
		replaceString = replaceString == null ? "" : replaceString; //$NON-NLS-1$
	}

	for (Map.Entry<ActualTableName, List<IntrospectedColumn>> entry : columns.entrySet()) {
		for (IntrospectedColumn introspectedColumn : entry.getValue()) {
			String calculatedColumnName;
			if (pattern == null) {
				calculatedColumnName = introspectedColumn.getActualColumnName();
			} else {
				Matcher matcher = pattern.matcher(introspectedColumn.getActualColumnName());
				calculatedColumnName = matcher.replaceAll(replaceString);
			}

			if (isTrue(tc.getProperty(PropertyRegistry.TABLE_USE_ACTUAL_COLUMN_NAMES))) {
				introspectedColumn.setJavaProperty(getValidPropertyName(calculatedColumnName));
			} else if (isTrue(tc.getProperty(PropertyRegistry.TABLE_USE_COMPOUND_PROPERTY_NAMES))) {
				sb.setLength(0);
				sb.append(calculatedColumnName);
				sb.append('_');
				sb.append(getCamelCaseString(introspectedColumn.getRemarks(), true));
				introspectedColumn.setJavaProperty(getValidPropertyName(sb.toString()));
			} else {
				introspectedColumn.setJavaProperty(getCamelCaseString(calculatedColumnName, false));
			}

			FullyQualifiedJavaType fullyQualifiedJavaType = javaTypeResolver.calculateJavaType(introspectedColumn);

			if (fullyQualifiedJavaType != null) {
				introspectedColumn.setFullyQualifiedJavaType(fullyQualifiedJavaType);
				introspectedColumn.setJdbcTypeName(javaTypeResolver.calculateJdbcTypeName(introspectedColumn));
			} else {
				// type cannot be resolved. Check for ignored or overridden
				boolean warn = true;
				if (tc.isColumnIgnored(introspectedColumn.getActualColumnName())) {
					warn = false;
				}

				ColumnOverride co = tc.getColumnOverride(introspectedColumn.getActualColumnName());
				if (co != null) {
					if (stringHasValue(co.getJavaType()) && stringHasValue(co.getJavaType())) {
						warn = false;
					}
				}

				// if the type is not supported, then we'll report a warning
				if (warn) {
					introspectedColumn.setFullyQualifiedJavaType(FullyQualifiedJavaType.getObjectInstance());
					introspectedColumn.setJdbcTypeName("OTHER"); //$NON-NLS-1$

					String warning = getString(
							"Warning.14", //$NON-NLS-1$
							Integer.toString(introspectedColumn.getJdbcType()), entry.getKey().toString(),
							introspectedColumn.getActualColumnName());

					warnings.add(warning);
				}
			}

			if (context.autoDelimitKeywords()) {
				if (SqlReservedWords.containsWord(introspectedColumn.getActualColumnName())) {
					introspectedColumn.setColumnNameDelimited(true);
				}
			}

			if (tc.isAllColumnDelimitingEnabled()) {
				introspectedColumn.setColumnNameDelimited(true);
			}
		}
	}
}
 
开发者ID:fnyexx,项目名称:mybator,代码行数:79,代码来源:DatabaseIntrospector.java


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