本文整理汇总了Java中org.mybatis.generator.config.ColumnOverride类的典型用法代码示例。如果您正苦于以下问题:Java ColumnOverride类的具体用法?Java ColumnOverride怎么用?Java ColumnOverride使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ColumnOverride类属于org.mybatis.generator.config包,在下文中一共展示了ColumnOverride类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: reportIntrospectionWarnings
import org.mybatis.generator.config.ColumnOverride; //导入依赖的package包/类
/**
* Report introspection warnings.
*
* @param introspectedTable
* the introspected table
* @param tableConfiguration
* the table configuration
* @param table
* the table
*/
private void reportIntrospectionWarnings(
IntrospectedTable introspectedTable,
TableConfiguration tableConfiguration, FullyQualifiedTable table) {
// make sure that every column listed in column overrides
// actually exists in the table
for (ColumnOverride columnOverride : tableConfiguration
.getColumnOverrides()) {
if (introspectedTable.getColumn(columnOverride.getColumnName()) == null) {
warnings.add(getString("Warning.3", //$NON-NLS-1$
columnOverride.getColumnName(), table.toString()));
}
}
// make sure that every column listed in ignored columns
// actually exists in the table
for (String string : tableConfiguration.getIgnoredColumnsInError()) {
warnings.add(getString("Warning.4", //$NON-NLS-1$
string, table.toString()));
}
GeneratedKey generatedKey = tableConfiguration.getGeneratedKey();
if (generatedKey != null
&& introspectedTable.getColumn(generatedKey.getColumn()) == null) {
if (generatedKey.isIdentity()) {
warnings.add(getString("Warning.5", //$NON-NLS-1$
generatedKey.getColumn(), table.toString()));
} else {
warnings.add(getString("Warning.6", //$NON-NLS-1$
generatedKey.getColumn(), table.toString()));
}
}
for (IntrospectedColumn ic : introspectedTable.getAllColumns()) {
if (JavaReservedWords.containsWord(ic.getJavaProperty())) {
warnings.add(getString("Warning.26", //$NON-NLS-1$
ic.getActualColumnName(), table.toString()));
}
}
}
开发者ID:bandaotixi,项目名称:generator_mybatis,代码行数:50,代码来源:DatabaseIntrospector.java
示例2: applyColumnOverrides
import org.mybatis.generator.config.ColumnOverride; //导入依赖的package包/类
private void applyColumnOverrides(TableConfiguration tc, Map<ActualTableName, List<IntrospectedColumn>> columns) {
for (Map.Entry<ActualTableName, List<IntrospectedColumn>> entry : columns.entrySet()) {
for (IntrospectedColumn introspectedColumn : entry.getValue()) {
ColumnOverride columnOverride = tc.getColumnOverride(introspectedColumn.getActualColumnName());
if (columnOverride != null) {
if (stringHasValue(columnOverride.getJavaProperty())) {
introspectedColumn.setJavaProperty(columnOverride.getJavaProperty());
}
if (stringHasValue(columnOverride.getJavaType())) {
introspectedColumn.setFullyQualifiedJavaType(new FullyQualifiedJavaType(columnOverride
.getJavaType()));
}
if (stringHasValue(columnOverride.getJdbcType())) {
introspectedColumn.setJdbcTypeName(columnOverride.getJdbcType());
}
if (stringHasValue(columnOverride.getTypeHandler())) {
introspectedColumn.setTypeHandler(columnOverride.getTypeHandler());
}
if (columnOverride.isColumnNameDelimited()) {
introspectedColumn.setColumnNameDelimited(true);
}
introspectedColumn.setProperties(columnOverride.getProperties());
}
}
}
}
开发者ID:funny5258,项目名称:autocode,代码行数:33,代码来源:DatabaseIntrospector.java
示例3: reportIntrospectionWarnings
import org.mybatis.generator.config.ColumnOverride; //导入依赖的package包/类
private void reportIntrospectionWarnings(
IntrospectedTable introspectedTable,
TableConfiguration tableConfiguration, FullyQualifiedTable table) {
// make sure that every column listed in column overrides
// actually exists in the table
for (ColumnOverride columnOverride : tableConfiguration
.getColumnOverrides()) {
if (introspectedTable.getColumn(columnOverride.getColumnName()) == null) {
warnings.add(getString("Warning.3", //$NON-NLS-1$
columnOverride.getColumnName(), table.toString()));
}
}
// make sure that every column listed in ignored columns
// actually exists in the table
for (String string : tableConfiguration.getIgnoredColumnsInError()) {
warnings.add(getString("Warning.4", //$NON-NLS-1$
string, table.toString()));
}
GeneratedKey generatedKey = tableConfiguration.getGeneratedKey();
if (generatedKey != null
&& introspectedTable.getColumn(generatedKey.getColumn()) == null) {
if (generatedKey.isIdentity()) {
warnings.add(getString("Warning.5", //$NON-NLS-1$
generatedKey.getColumn(), table.toString()));
} else {
warnings.add(getString("Warning.6", //$NON-NLS-1$
generatedKey.getColumn(), table.toString()));
}
}
}
开发者ID:handosme,项目名称:mybatis-generator-plus,代码行数:33,代码来源:DatabaseIntrospector.java
示例4: reportIntrospectionWarnings
import org.mybatis.generator.config.ColumnOverride; //导入依赖的package包/类
private void reportIntrospectionWarnings(IntrospectedTable introspectedTable,
TableConfiguration tableConfiguration, FullyQualifiedTable table) {
// make sure that every column listed in column overrides
// actually exists in the table
for (ColumnOverride columnOverride : tableConfiguration.getColumnOverrides()) {
if (introspectedTable.getColumn(columnOverride.getColumnName()) == null) {
warnings.add(getString("Warning.3", //$NON-NLS-1$
columnOverride.getColumnName(), table.toString()));
}
}
// make sure that every column listed in ignored columns
// actually exists in the table
for (String string : tableConfiguration.getIgnoredColumnsInError()) {
warnings.add(getString("Warning.4", //$NON-NLS-1$
string, table.toString()));
}
GeneratedKey generatedKey = tableConfiguration.getGeneratedKey();
if (generatedKey != null && introspectedTable.getColumn(generatedKey.getColumn()) == null) {
if (generatedKey.isIdentity()) {
warnings.add(getString("Warning.5", //$NON-NLS-1$
generatedKey.getColumn(), table.toString()));
} else {
warnings.add(getString("Warning.6", //$NON-NLS-1$
generatedKey.getColumn(), table.toString()));
}
}
}
开发者ID:fnyexx,项目名称:mybator,代码行数:30,代码来源:DatabaseIntrospector.java
示例5: applyColumnOverrides
import org.mybatis.generator.config.ColumnOverride; //导入依赖的package包/类
private void applyColumnOverrides(TableConfiguration tc, Map<ActualTableName, List<IntrospectedColumn>> columns) {
for (Map.Entry<ActualTableName, List<IntrospectedColumn>> entry : columns.entrySet()) {
for (IntrospectedColumn introspectedColumn : entry.getValue()) {
ColumnOverride columnOverride = tc.getColumnOverride(introspectedColumn.getActualColumnName());
if (columnOverride != null) {
if (logger.isDebugEnabled()) {
logger.debug(getString("Tracing.4", //$NON-NLS-1$
introspectedColumn.getActualColumnName(), entry.getKey().toString()));
}
if (stringHasValue(columnOverride.getJavaProperty())) {
introspectedColumn.setJavaProperty(columnOverride.getJavaProperty());
}
if (stringHasValue(columnOverride.getJavaType())) {
introspectedColumn.setFullyQualifiedJavaType(new FullyQualifiedJavaType(columnOverride
.getJavaType()));
}
if (stringHasValue(columnOverride.getJdbcType())) {
introspectedColumn.setJdbcTypeName(columnOverride.getJdbcType());
}
if (stringHasValue(columnOverride.getTypeHandler())) {
introspectedColumn.setTypeHandler(columnOverride.getTypeHandler());
}
if (columnOverride.isColumnNameDelimited()) {
introspectedColumn.setColumnNameDelimited(true);
}
introspectedColumn.setProperties(columnOverride.getProperties());
}
}
}
}
开发者ID:fnyexx,项目名称:mybator,代码行数:38,代码来源:DatabaseIntrospector.java
示例6: applyColumnOverrides
import org.mybatis.generator.config.ColumnOverride; //导入依赖的package包/类
/**
* Apply column overrides.
*
* @param tc
* the tc
* @param columns
* the columns
*/
private void applyColumnOverrides(TableConfiguration tc,
Map<ActualTableName, List<IntrospectedColumn>> columns) {
for (Map.Entry<ActualTableName, List<IntrospectedColumn>> entry : columns
.entrySet()) {
for (IntrospectedColumn introspectedColumn : entry.getValue()) {
ColumnOverride columnOverride = tc
.getColumnOverride(introspectedColumn
.getActualColumnName());
if (columnOverride != null) {
if (logger.isDebugEnabled()) {
logger.debug(getString("Tracing.4", //$NON-NLS-1$
introspectedColumn.getActualColumnName(), entry
.getKey().toString()));
}
if (stringHasValue(columnOverride
.getJavaProperty())) {
introspectedColumn.setJavaProperty(columnOverride
.getJavaProperty());
}
if (stringHasValue(columnOverride
.getJavaType())) {
introspectedColumn
.setFullyQualifiedJavaType(new FullyQualifiedJavaType(
columnOverride.getJavaType()));
}
if (stringHasValue(columnOverride
.getJdbcType())) {
introspectedColumn.setJdbcTypeName(columnOverride
.getJdbcType());
}
if (stringHasValue(columnOverride
.getTypeHandler())) {
introspectedColumn.setTypeHandler(columnOverride
.getTypeHandler());
}
if (columnOverride.isColumnNameDelimited()) {
introspectedColumn.setColumnNameDelimited(true);
}
introspectedColumn.setGeneratedAlways(columnOverride.isGeneratedAlways());
introspectedColumn.setProperties(columnOverride
.getProperties());
}
}
}
}
开发者ID:bandaotixi,项目名称:generator_mybatis,代码行数:63,代码来源:DatabaseIntrospector.java
示例7: parseColumnOverride
import org.mybatis.generator.config.ColumnOverride; //导入依赖的package包/类
private void parseColumnOverride(TableConfiguration tc, Node node) {
Properties attributes = parseAttributes(node);
String column = attributes.getProperty("column"); //$NON-NLS-1$
String property = attributes.getProperty("property"); //$NON-NLS-1$
String javaType = attributes.getProperty("javaType"); //$NON-NLS-1$
String jdbcType = attributes.getProperty("jdbcType"); //$NON-NLS-1$
String typeHandler = attributes.getProperty("typeHandler"); //$NON-NLS-1$
String delimitedColumnName = attributes
.getProperty("delimitedColumnName"); //$NON-NLS-1$
String isGeneratedAlways = attributes.getProperty("isGeneratedAlways"); //$NON-NLS-1$
ColumnOverride co = new ColumnOverride(column);
if (stringHasValue(property)) {
co.setJavaProperty(property);
}
if (stringHasValue(javaType)) {
co.setJavaType(javaType);
}
if (stringHasValue(jdbcType)) {
co.setJdbcType(jdbcType);
}
if (stringHasValue(typeHandler)) {
co.setTypeHandler(typeHandler);
}
if (stringHasValue(delimitedColumnName)) {
co.setColumnNameDelimited(isTrue(delimitedColumnName));
}
if (stringHasValue(isGeneratedAlways)) {
co.setGeneratedAlways(Boolean.parseBoolean(isGeneratedAlways));
}
NodeList nodeList = node.getChildNodes();
for (int i = 0; i < nodeList.getLength(); i++) {
Node childNode = nodeList.item(i);
if (childNode.getNodeType() != Node.ELEMENT_NODE) {
continue;
}
if ("property".equals(childNode.getNodeName())) { //$NON-NLS-1$
parseProperty(co, childNode);
}
}
tc.addColumnOverride(co);
}
开发者ID:bandaotixi,项目名称:generator_mybatis,代码行数:53,代码来源:MyBatisGeneratorConfigurationParser.java
示例8: applyColumnOverrides
import org.mybatis.generator.config.ColumnOverride; //导入依赖的package包/类
/**
* Apply column overrides.
*
* @param tc
* the tc
* @param columns
* the columns
*/
private void applyColumnOverrides(TableConfiguration tc,
Map<ActualTableName, List<IntrospectedColumn>> columns) {
for (Map.Entry<ActualTableName, List<IntrospectedColumn>> entry : columns
.entrySet()) {
for (IntrospectedColumn introspectedColumn : entry.getValue()) {
ColumnOverride columnOverride = tc
.getColumnOverride(introspectedColumn
.getActualColumnName());
if (columnOverride != null) {
if (logger.isDebugEnabled()) {
logger.debug(getString("Tracing.4", //$NON-NLS-1$
introspectedColumn.getActualColumnName(), entry
.getKey().toString()));
}
if (stringHasValue(columnOverride
.getJavaProperty())) {
introspectedColumn.setJavaProperty(columnOverride
.getJavaProperty());
}
if (stringHasValue(columnOverride
.getJavaType())) {
introspectedColumn
.setFullyQualifiedJavaType(new FullyQualifiedJavaType(
columnOverride.getJavaType()));
}
if (stringHasValue(columnOverride
.getJdbcType())) {
introspectedColumn.setJdbcTypeName(columnOverride
.getJdbcType());
}
if (stringHasValue(columnOverride
.getTypeHandler())) {
introspectedColumn.setTypeHandler(columnOverride
.getTypeHandler());
}
if (columnOverride.isColumnNameDelimited()) {
introspectedColumn.setColumnNameDelimited(true);
}
introspectedColumn.setProperties(columnOverride
.getProperties());
}
}
}
}
开发者ID:backkoms,项目名称:mybatis-generator-comments,代码行数:60,代码来源:DatabaseIntrospector.java
示例9: parseColumnOverride
import org.mybatis.generator.config.ColumnOverride; //导入依赖的package包/类
private void parseColumnOverride(TableConfiguration tc, Node node) {
Properties attributes = parseAttributes(node);
String column = attributes.getProperty("column"); //$NON-NLS-1$
String property = attributes.getProperty("property"); //$NON-NLS-1$
String javaType = attributes.getProperty("javaType"); //$NON-NLS-1$
String jdbcType = attributes.getProperty("jdbcType"); //$NON-NLS-1$
String typeHandler = attributes.getProperty("typeHandler"); //$NON-NLS-1$
String delimitedColumnName = attributes
.getProperty("delimitedColumnName"); //$NON-NLS-1$
ColumnOverride co = new ColumnOverride(column);
if (stringHasValue(property)) {
co.setJavaProperty(property);
}
if (stringHasValue(javaType)) {
co.setJavaType(javaType);
}
if (stringHasValue(jdbcType)) {
co.setJdbcType(jdbcType);
}
if (stringHasValue(typeHandler)) {
co.setTypeHandler(typeHandler);
}
if (stringHasValue(delimitedColumnName)) {
co.setColumnNameDelimited(isTrue(delimitedColumnName));
}
NodeList nodeList = node.getChildNodes();
for (int i = 0; i < nodeList.getLength(); i++) {
Node childNode = nodeList.item(i);
if (childNode.getNodeType() != Node.ELEMENT_NODE) {
continue;
}
if ("property".equals(childNode.getNodeName())) { //$NON-NLS-1$
parseProperty(co, childNode);
}
}
tc.addColumnOverride(co);
}
开发者ID:backkoms,项目名称:mybatis-generator-comments,代码行数:48,代码来源:IbatorConfigurationParser.java
示例10: applyColumnOverrides
import org.mybatis.generator.config.ColumnOverride; //导入依赖的package包/类
private void applyColumnOverrides(TableConfiguration tc,
Map<ActualTableName, List<IntrospectedColumn>> columns) {
for (Map.Entry<ActualTableName, List<IntrospectedColumn>> entry : columns
.entrySet()) {
for (IntrospectedColumn introspectedColumn : entry.getValue()) {
ColumnOverride columnOverride = tc
.getColumnOverride(introspectedColumn
.getActualColumnName());
if (columnOverride != null) {
if (logger.isDebugEnabled()) {
logger.debug(getString("Tracing.4", //$NON-NLS-1$
introspectedColumn.getActualColumnName(), entry
.getKey().toString()));
}
if (stringHasValue(columnOverride
.getJavaProperty())) {
introspectedColumn.setJavaProperty(columnOverride
.getJavaProperty());
}
if (stringHasValue(columnOverride
.getJavaType())) {
introspectedColumn
.setFullyQualifiedJavaType(new FullyQualifiedJavaType(
columnOverride.getJavaType()));
}
if (stringHasValue(columnOverride
.getJdbcType())) {
introspectedColumn.setJdbcTypeName(columnOverride
.getJdbcType());
}
if (stringHasValue(columnOverride
.getTypeHandler())) {
introspectedColumn.setTypeHandler(columnOverride
.getTypeHandler());
}
if (columnOverride.isColumnNameDelimited()) {
introspectedColumn.setColumnNameDelimited(true);
}
introspectedColumn.setProperties(columnOverride
.getProperties());
}
}
}
}
开发者ID:handosme,项目名称:mybatis-generator-plus,代码行数:52,代码来源:DatabaseIntrospector.java
示例11: calculateExtraColumnInformation
import org.mybatis.generator.config.ColumnOverride; //导入依赖的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
示例12: parseColumnOverride
import org.mybatis.generator.config.ColumnOverride; //导入依赖的package包/类
private void parseColumnOverride(TableConfiguration tc, Node node) {
Properties attributes = parseAttributes(node);
String column = attributes.getProperty("column"); //$NON-NLS-1$
String property = attributes.getProperty("property"); //$NON-NLS-1$
String javaType = attributes.getProperty("javaType"); //$NON-NLS-1$
String jdbcType = attributes.getProperty("jdbcType"); //$NON-NLS-1$
String typeHandler = attributes.getProperty("typeHandler"); //$NON-NLS-1$
String delimitedColumnName = attributes.getProperty("delimitedColumnName"); //$NON-NLS-1$
ColumnOverride co = new ColumnOverride(column);
if (stringHasValue(property)) {
co.setJavaProperty(property);
}
if (stringHasValue(javaType)) {
co.setJavaType(javaType);
}
if (stringHasValue(jdbcType)) {
co.setJdbcType(jdbcType);
}
if (stringHasValue(typeHandler)) {
co.setTypeHandler(typeHandler);
}
if (stringHasValue(delimitedColumnName)) {
co.setColumnNameDelimited(isTrue(delimitedColumnName));
}
NodeList nodeList = node.getChildNodes();
for (int i = 0; i < nodeList.getLength(); i++) {
Node childNode = nodeList.item(i);
if (childNode.getNodeType() != Node.ELEMENT_NODE) {
continue;
}
if ("property".equals(childNode.getNodeName())) { //$NON-NLS-1$
parseProperty(co, childNode);
}
}
tc.addColumnOverride(co);
}
开发者ID:fnyexx,项目名称:mybator,代码行数:47,代码来源:IbatorConfigurationParser.java
注:本文中的org.mybatis.generator.config.ColumnOverride类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论