Java Code Examples for org.mybatis.generator.internal.util.StringUtility#stringContainsSpace()

The following examples show how to use org.mybatis.generator.internal.util.StringUtility#stringContainsSpace() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MyPgMapperPlugin.java    From jvue-admin with MIT License 6 votes vote down vote up
/**
 * 处理实体类的包和@Table注解
 *
 * @param topLevelClass
 * @param introspectedTable
 */
private void processEntityClass(TopLevelClass topLevelClass, IntrospectedTable introspectedTable) {
    //引入JPA注解
    topLevelClass.addImportedType("javax.persistence.*");
    String tableName = introspectedTable.getFullyQualifiedTableNameAtRuntime();
    //如果包含空格,或者需要分隔符,需要完善
    if (StringUtility.stringContainsSpace(tableName)) {
        tableName = context.getBeginningDelimiter()
                + tableName
                + context.getEndingDelimiter();
    }
    //是否忽略大小写,对于区分大小写的数据库,会有用
    if (caseSensitive && !topLevelClass.getType().getShortName().equals(tableName)) {
        topLevelClass.addAnnotation("@Table(name = \"" + getDelimiterName(tableName) + "\")");
    } else if (!topLevelClass.getType().getShortName().equalsIgnoreCase(tableName)) {
        topLevelClass.addAnnotation("@Table(name = \"" + getDelimiterName(tableName) + "\")");
    } else if (StringUtility.stringHasValue(schema)
            || StringUtility.stringHasValue(beginningDelimiter)
            || StringUtility.stringHasValue(endingDelimiter)) {
        topLevelClass.addAnnotation("@Table(name = \"" + getDelimiterName(tableName) + "\")");
    } else if(forceAnnotation){
        topLevelClass.addAnnotation("@Table(name = \"" + getDelimiterName(tableName) + "\")");
    }
}
 
Example 2
Source File: MapperPlugin.java    From tk-mybatis with MIT License 6 votes vote down vote up
/**
 * 处理实体类的包和@Table注解
 *
 * @param topLevelClass
 * @param introspectedTable
 */
private void processEntityClass(TopLevelClass topLevelClass, IntrospectedTable introspectedTable) {
    //引入JPA注解
    topLevelClass.addImportedType("javax.persistence.*");
    String tableName = introspectedTable.getFullyQualifiedTableNameAtRuntime();
    //如果包含空格,或者需要分隔符,需要完善
    if (StringUtility.stringContainsSpace(tableName)) {
        tableName = context.getBeginningDelimiter()
                + tableName
                + context.getEndingDelimiter();
    }
    //是否忽略大小写,对于区分大小写的数据库,会有用
    if (caseSensitive && !topLevelClass.getType().getShortName().equals(tableName)) {
        topLevelClass.addAnnotation("@Table(name = \"" + getDelimiterName(tableName) + "\")");
    } else if (!topLevelClass.getType().getShortName().equalsIgnoreCase(tableName)) {
        topLevelClass.addAnnotation("@Table(name = \"" + getDelimiterName(tableName) + "\")");
    } else if (StringUtility.stringHasValue(schema)
            || StringUtility.stringHasValue(beginningDelimiter)
            || StringUtility.stringHasValue(endingDelimiter)) {
        topLevelClass.addAnnotation("@Table(name = \"" + getDelimiterName(tableName) + "\")");
    }
}
 
Example 3
Source File: CrudSupportPlugin.java    From azeroth with Apache License 2.0 6 votes vote down vote up
/**
 * 处理实体类的包和@Table注解
 *
 * @param topLevelClass
 * @param introspectedTable
 */
private void processEntityClass(TopLevelClass topLevelClass, IntrospectedTable introspectedTable) {
    //引入JPA注解
    topLevelClass.addImportedType("javax.persistence.*");
    String tableName = introspectedTable.getFullyQualifiedTableNameAtRuntime();
    //如果包含空格,或者需要分隔符,需要完善
    if (StringUtility.stringContainsSpace(tableName)) {
        tableName = context.getBeginningDelimiter()
                + tableName
                + context.getEndingDelimiter();
    }
    //是否忽略大小写,对于区分大小写的数据库,会有用
    if (caseSensitive && !topLevelClass.getType().getShortName().equals(tableName)) {
        topLevelClass.addAnnotation("@Table(name = \"" + getDelimiterName(tableName) + "\")");
    } else if (!topLevelClass.getType().getShortName().equalsIgnoreCase(tableName)) {
        topLevelClass.addAnnotation("@Table(name = \"" + getDelimiterName(tableName) + "\")");
    } else if (StringUtility.stringHasValue(schema)
            || StringUtility.stringHasValue(beginningDelimiter)
            || StringUtility.stringHasValue(endingDelimiter)) {
        topLevelClass.addAnnotation("@Table(name = \"" + getDelimiterName(tableName) + "\")");
    }
}
 
Example 4
Source File: CrudSupportPlugin.java    From jeesuite-libs with Apache License 2.0 6 votes vote down vote up
/**
 * 处理实体类的包和@Table注解
 *
 * @param topLevelClass
 * @param introspectedTable
 */
private void processEntityClass(TopLevelClass topLevelClass, IntrospectedTable introspectedTable) {
    //引入JPA注解
    topLevelClass.addImportedType("javax.persistence.*");
    String tableName = introspectedTable.getFullyQualifiedTableNameAtRuntime();
    //如果包含空格,或者需要分隔符,需要完善
    if (StringUtility.stringContainsSpace(tableName)) {
        tableName = context.getBeginningDelimiter()
                + tableName
                + context.getEndingDelimiter();
    }
    //是否忽略大小写,对于区分大小写的数据库,会有用
    if (caseSensitive && !topLevelClass.getType().getShortName().equals(tableName)) {
        topLevelClass.addAnnotation("@Table(name = \"" + getDelimiterName(tableName) + "\")");
    } else if (!topLevelClass.getType().getShortName().equalsIgnoreCase(tableName)) {
        topLevelClass.addAnnotation("@Table(name = \"" + getDelimiterName(tableName) + "\")");
    } else if (StringUtility.stringHasValue(schema)
            || StringUtility.stringHasValue(beginningDelimiter)
            || StringUtility.stringHasValue(endingDelimiter)) {
        topLevelClass.addAnnotation("@Table(name = \"" + getDelimiterName(tableName) + "\")");
    }
}
 
Example 5
Source File: IntrospectedColumn.java    From mapper-generator-javafx with Apache License 2.0 4 votes vote down vote up
public void setActualColumnName(String actualColumnName) {
    this.actualColumnName = actualColumnName;
    isColumnNameDelimited = StringUtility
            .stringContainsSpace(actualColumnName);
}
 
Example 6
Source File: IntrospectedColumn.java    From mybatis-generator-core-fix with Apache License 2.0 4 votes vote down vote up
public void setActualColumnName(String actualColumnName) {
    this.actualColumnName = actualColumnName;
    isColumnNameDelimited = StringUtility
            .stringContainsSpace(actualColumnName);
}
 
Example 7
Source File: IntrospectedColumn.java    From mybatis-generator-plus with Apache License 2.0 4 votes vote down vote up
public void setActualColumnName(String actualColumnName) {
    this.actualColumnName = actualColumnName;
    isColumnNameDelimited = StringUtility
            .stringContainsSpace(actualColumnName);
}