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


Java Rules.generateBaseRecordClass方法代码示例

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


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

示例1: isTopmostModelClass

import org.mybatis.generator.internal.rules.Rules; //导入方法依赖的package包/类
public static boolean isTopmostModelClass(Plugin.ModelClassType type, IntrospectedTable table) {
    Rules rules = table.getRules();
    if (type == Plugin.ModelClassType.PRIMARY_KEY)
        return rules.generatePrimaryKeyClass();
    if (type == Plugin.ModelClassType.BASE_RECORD)
        return !rules.generatePrimaryKeyClass() && rules.generateBaseRecordClass();
    if (type == Plugin.ModelClassType.RECORD_WITH_BLOBS)
        return !rules.generatePrimaryKeyClass() && !rules.generateBaseRecordClass() && rules.generateRecordWithBLOBsClass();
    return false;
}
 
开发者ID:vsl1978,项目名称:mybatis-generator-pluginsplus,代码行数:11,代码来源:MBGenerator.java

示例2: isUndermostModelClass

import org.mybatis.generator.internal.rules.Rules; //导入方法依赖的package包/类
public static boolean isUndermostModelClass(Plugin.ModelClassType type, IntrospectedTable table) {
    Rules rules = table.getRules();
    if (type == Plugin.ModelClassType.PRIMARY_KEY)
        return rules.generatePrimaryKeyClass() && !rules.generateBaseRecordClass() && !rules.generateRecordWithBLOBsClass();
    if (type == Plugin.ModelClassType.BASE_RECORD)
        return rules.generateBaseRecordClass() && !rules.generateRecordWithBLOBsClass();
    if (type == Plugin.ModelClassType.RECORD_WITH_BLOBS)
        return rules.generateRecordWithBLOBsClass();
    return false;
}
 
开发者ID:vsl1978,项目名称:mybatis-generator-pluginsplus,代码行数:11,代码来源:MBGenerator.java

示例3: genClassName

import org.mybatis.generator.internal.rules.Rules; //导入方法依赖的package包/类
public Pair<String, Set<FullyQualifiedJavaType>> genClassName() {
    String s = name;
    Set<FullyQualifiedJavaType> imports = new HashSet<FullyQualifiedJavaType>();
    if (table != null) {
        Rules rules = table.getRules();
        boolean genPK = rules.generatePrimaryKeyClass(), genBase = rules.generateBaseRecordClass(), genBLOB = rules.generateRecordWithBLOBsClass();
        boolean hasPK = table.hasPrimaryKeyColumns(), hasBase = table.hasBaseColumns(), hasBLOB = table.hasBLOBColumns();
        FullyQualifiedJavaType pk = genPK && hasPK ? new FullyQualifiedJavaType(table.getPrimaryKeyType()) : null;
        FullyQualifiedJavaType base = genBase && (hasBase || !genPK && hasPK || !genBLOB && hasBLOB) ? new FullyQualifiedJavaType(table.getBaseRecordType()) : null;
        FullyQualifiedJavaType blob = genBLOB && hasBLOB ? new FullyQualifiedJavaType(table.getRecordWithBLOBsType()) : null;
        if (!genPK && hasPK)
            pk = base;
        if (!genBLOB && hasBLOB)
            blob = base;
        FullyQualifiedJavaType model = Objects.nvl(blob, base, pk);

        s = replaceAndImport(s, "(?i)\\*(example|criteria)", new FullyQualifiedJavaType(table.getExampleType()), imports);
        s = replaceAndImport(s, "(?i)\\*mapper", new FullyQualifiedJavaType(table.getMyBatis3JavaMapperType()), imports);
        s = replaceAndImport(s, "(?i)\\*model", model, imports);
        s = replaceAndImport(s, "(?i)\\*pk", pk, imports);
        s = replaceAndImport(s, "(?i)\\*base", base, imports);
        s = replaceAndImport(s, "(?i)\\*blob", blob, imports);
        if (hasPK) {
            FullyQualifiedJavaType javaPK = table.getPrimaryKeyColumns().get(0).getFullyQualifiedJavaType();
            s = replaceAndImport(s, "(?i)\\*(java\\.?pk(\\.?class|\\.?type)?|pk\\.?(class|type))", javaPK, imports);
        }
    }
    s = replaceAndImport(s, "\\*", type, imports);
    return Pair.of(s, imports);
}
 
开发者ID:vsl1978,项目名称:mybatis-generator-pluginsplus,代码行数:31,代码来源:SuperclassPlugin.java

示例4: MyBatisClasses

import org.mybatis.generator.internal.rules.Rules; //导入方法依赖的package包/类
private MyBatisClasses(IntrospectedTable introspectedTable, FullyQualifiedJavaType klazz, FullyQualifiedJavaType pk, FullyQualifiedJavaType base, FullyQualifiedJavaType blob, FullyQualifiedJavaType example, FullyQualifiedJavaType mapper) {
    Rules rules = introspectedTable.getRules();

    FullyQualifiedJavaType[] types = {pk, base, blob, example, mapper};
    String fqklazz = klazz.getFullyQualifiedName().intern();
    String[] fq = {pk.getFullyQualifiedName().intern(), base.getFullyQualifiedName().intern(), blob.getFullyQualifiedName().intern(), example.getFullyQualifiedName().intern(), mapper.getFullyQualifiedName().intern()};

    String[] s = {pk.getShortName().intern(), base.getShortName().intern(), blob.getShortName().intern(), example.getShortName().intern(), mapper.getShortName().intern()};

    boolean[][] efq = compare(fq);
    boolean[][] es = compare(s);
    boolean[][] ep = compare(pk.getPackageName().intern(), base.getPackageName().intern(), blob.getPackageName().intern(), example.getPackageName().intern(), mapper.getPackageName().intern());

    int idx = -1;
    for (int i = 0; i < fq.length && idx < 0; i++) if (fqklazz == fq[i]) idx = i;

    String[] names = new String[fq.length];
    boolean[] imports = new boolean[fq.length];

    if (idx >= 0) {
        for (int i = 0; i < es.length; i++) {
            if (i == idx) {
                names[i] = s[idx];
                imports[i] = false;
            } else if (es[idx][i]) {
                /* equal class names */
                names[i] = ep[idx][i] ? /* same class */ s[i] : fq[i];
                imports[i] = !ep[idx][i];
            } else {
                names[i] = s[i];
                imports[i] = !ep[idx][i];
                for (int j = 0; j < i; j++) if (es[i][j]) names[i] = fq[i];
            }
        }
    } else {
        names = fq;
        Arrays.fill(imports, true);
    }

    this.names = new Types<String>(names[0], names[1], names[2], names[3], names[4]);
    this.imports  = new Types<FullyQualifiedJavaType>(imports[0] ? types[0] : null, imports[1] ? types[1] : null, imports[2] ? types[2] : null, imports[3] ? types[3] : null, imports[4] ? types[4] : null);
    this.types = new Types<FullyQualifiedJavaType>(pk, base, blob, example, mapper);

    this.exists = new Types<Boolean>(introspectedTable.hasPrimaryKeyColumns() && rules.generatePrimaryKeyClass(), rules.generateBaseRecordClass(), introspectedTable.hasBLOBColumns() && rules.generateRecordWithBLOBsClass(), rules.generateExampleClass(), true);
}
 
开发者ID:vsl1978,项目名称:mybatis-generator-pluginsplus,代码行数:46,代码来源:MyBatisClasses.java


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