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


Java Interface.addImportedType方法代码示例

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


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

示例1: addMapperAnnotations

import org.mybatis.generator.api.dom.java.Interface; //导入方法依赖的package包/类
@Override
public void addMapperAnnotations(Interface interfaze, Method method) {
    FullyQualifiedJavaType fqjt = new FullyQualifiedJavaType(introspectedTable.getMyBatis3SqlProviderType());
    interfaze.addImportedType(new FullyQualifiedJavaType("org.apache.ibatis.annotations.InsertProvider")); //$NON-NLS-1$
    StringBuilder sb = new StringBuilder();
    sb.append("@InsertProvider(type="); //$NON-NLS-1$
    sb.append(fqjt.getShortName());
    sb.append(".class, method=\""); //$NON-NLS-1$
    sb.append(introspectedTable.getInsertSelectiveStatementId());
    sb.append("\")"); //$NON-NLS-1$
    
    method.addAnnotation(sb.toString());

    GeneratedKey gk = introspectedTable.getGeneratedKey();
    if (gk != null) {
        addGeneratedKeyAnnotation(interfaze, method, gk);
    }
}
 
开发者ID:DomKing,项目名称:server-utility,代码行数:19,代码来源:AnnotatedInsertSelectiveMethodGenerator.java

示例2: addExtraImports

import org.mybatis.generator.api.dom.java.Interface; //导入方法依赖的package包/类
@Override
public void addExtraImports(Interface interfaze) {
    GeneratedKey gk = introspectedTable.getGeneratedKey();
    if (gk != null) {
        addGeneratedKeyImports(interfaze, gk);
    }
    interfaze.addImportedType(new FullyQualifiedJavaType("org.apache.ibatis.annotations.InsertProvider")); //$NON-NLS-1$
}
 
开发者ID:nextyu,项目名称:summer-mybatis-generator,代码行数:9,代码来源:AnnotatedInsertSelectiveMethodGenerator.java

示例3: clientGenerated

import org.mybatis.generator.api.dom.java.Interface; //导入方法依赖的package包/类
@Override
public boolean clientGenerated(Interface interfaze, TopLevelClass topLevelClass,
        IntrospectedTable introspectedTable) {

    interfaze.addImportedType(new FullyQualifiedJavaType("org.apache.ibatis.annotations.Mapper"));
    interfaze.addAnnotation("@Mapper");
    return true;
}
 
开发者ID:Yanweichen,项目名称:MybatisGeneatorUtil,代码行数:9,代码来源:MapperAnnotationPlugin.java

示例4: addMapperAnnotations

import org.mybatis.generator.api.dom.java.Interface; //导入方法依赖的package包/类
@Override
public void addMapperAnnotations(Interface interfaze, Method method) {
    FullyQualifiedJavaType fqjt = new FullyQualifiedJavaType(introspectedTable.getMyBatis3SqlProviderType());
    interfaze.addImportedType(new FullyQualifiedJavaType("org.apache.ibatis.annotations.UpdateProvider")); //$NON-NLS-1$
    StringBuilder sb = new StringBuilder();
    sb.append("@UpdateProvider(type="); //$NON-NLS-1$
    sb.append(fqjt.getShortName());
    sb.append(".class, method=\""); //$NON-NLS-1$
    sb.append(introspectedTable.getUpdateByPrimaryKeySelectiveStatementId());
    sb.append("\")"); //$NON-NLS-1$
    
    method.addAnnotation(sb.toString());
}
 
开发者ID:DomKing,项目名称:server-utility,代码行数:14,代码来源:AnnotatedUpdateByPrimaryKeySelectiveMethodGenerator.java

示例5: addMapperAnnotations

import org.mybatis.generator.api.dom.java.Interface; //导入方法依赖的package包/类
@Override
public void addMapperAnnotations(Interface interfaze, Method method) {
    FullyQualifiedJavaType fqjt = new FullyQualifiedJavaType(introspectedTable.getMyBatis3SqlProviderType());
    interfaze.addImportedType(new FullyQualifiedJavaType("org.apache.ibatis.annotations.UpdateProvider")); //$NON-NLS-1$
    StringBuilder sb = new StringBuilder();
    sb.append("@UpdateProvider(type="); //$NON-NLS-1$
    sb.append(fqjt.getShortName());
    sb.append(".class, method=\""); //$NON-NLS-1$
    sb.append(introspectedTable.getUpdateByExampleSelectiveStatementId());
    sb.append("\")"); //$NON-NLS-1$
    
    method.addAnnotation(sb.toString());
}
 
开发者ID:DomKing,项目名称:springbootWeb,代码行数:14,代码来源:AnnotatedUpdateByExampleSelectiveMethodGenerator.java

示例6: copyAndAddMethod

import org.mybatis.generator.api.dom.java.Interface; //导入方法依赖的package包/类
/**
 * Use the method copy constructor to create a new method, then
 * add the rowBounds parameter.
 * 
 * @param fullyQualifiedTable
 * @param method
 */
private void copyAndAddMethod(Method method, Interface interfaze) {
    Method newMethod = new Method(method);
    newMethod.setName(method.getName() + "WithRowbounds"); //$NON-NLS-1$
    newMethod.addParameter(new Parameter(rowBounds, "rowBounds")); //$NON-NLS-1$
    interfaze.addMethod(newMethod);
    interfaze.addImportedType(rowBounds);
}
 
开发者ID:xiachengwei5,项目名称:org.mybatis.generator.core-1.3.5,代码行数:15,代码来源:RowBoundsPlugin.java

示例7: getCompilationUnits

import org.mybatis.generator.api.dom.java.Interface; //导入方法依赖的package包/类
@Override
public List<CompilationUnit> getCompilationUnits() {
    progressCallback.startTask(getString("Progress.17", //$NON-NLS-1$
            introspectedTable.getFullyQualifiedTable().toString()));
    CommentGenerator commentGenerator = context.getCommentGenerator();

    FullyQualifiedJavaType type = new FullyQualifiedJavaType(
            introspectedTable.getMyBatis3JavaMapperType());
    Interface interfaze = new Interface(type);
    interfaze.setVisibility(JavaVisibility.PUBLIC);
    commentGenerator.addJavaFileComment(interfaze);

    String rootInterface = introspectedTable
            .getTableConfigurationProperty(PropertyRegistry.ANY_ROOT_INTERFACE);
    if (!stringHasValue(rootInterface)) {
        rootInterface = context.getJavaClientGeneratorConfiguration()
            .getProperty(PropertyRegistry.ANY_ROOT_INTERFACE);
    }

    if (stringHasValue(rootInterface)) {
        FullyQualifiedJavaType fqjt = new FullyQualifiedJavaType(
                rootInterface);
        interfaze.addSuperInterface(fqjt);
        interfaze.addImportedType(fqjt);
    }
    
    addDeleteByPrimaryKeyMethod(interfaze);
    addInsertMethod(interfaze);
    addSelectByPrimaryKeyMethod(interfaze);
    addSelectAllMethod(interfaze);
    addUpdateByPrimaryKeyMethod(interfaze);

    List<CompilationUnit> answer = new ArrayList<CompilationUnit>();
    if (context.getPlugins().clientGenerated(interfaze, null,
            introspectedTable)) {
        answer.add(interfaze);
    }
    
    List<CompilationUnit> extraCompilationUnits = getExtraCompilationUnits();
    if (extraCompilationUnits != null) {
        answer.addAll(extraCompilationUnits);
    }

    return answer;
}
 
开发者ID:nextyu,项目名称:summer-mybatis-generator,代码行数:46,代码来源:SimpleJavaClientGenerator.java

示例8: getCompilationUnits

import org.mybatis.generator.api.dom.java.Interface; //导入方法依赖的package包/类
@Override
public List<CompilationUnit> getCompilationUnits() {
    progressCallback.startTask(getString("Progress.17", //$NON-NLS-1$
            introspectedTable.getFullyQualifiedTable().toString()));
    CommentGenerator commentGenerator = context.getCommentGenerator();

    FullyQualifiedJavaType type = new FullyQualifiedJavaType(
            introspectedTable.getMyBatis3JavaMapperType());
    Interface interfaze = new Interface(type);
    interfaze.setVisibility(JavaVisibility.PUBLIC);
    commentGenerator.addJavaFileComment(interfaze);

    String rootInterface = introspectedTable
            .getTableConfigurationProperty(PropertyRegistry.ANY_ROOT_INTERFACE);
    if (!stringHasValue(rootInterface)) {
        rootInterface = context.getJavaClientGeneratorConfiguration()
            .getProperty(PropertyRegistry.ANY_ROOT_INTERFACE);
    }

    if (stringHasValue(rootInterface)) {
        FullyQualifiedJavaType fqjt = new FullyQualifiedJavaType(
                rootInterface);
        interfaze.addSuperInterface(fqjt);
        interfaze.addImportedType(fqjt);
    }
    
    addCountByExampleMethod(interfaze);
    addDeleteByExampleMethod(interfaze);
    addDeleteByPrimaryKeyMethod(interfaze);
    addInsertMethod(interfaze);
    addInsertSelectiveMethod(interfaze);
    addSelectByExampleWithBLOBsMethod(interfaze);
    addSelectByExampleWithoutBLOBsMethod(interfaze);
    addSelectByPrimaryKeyMethod(interfaze);
    addUpdateByExampleSelectiveMethod(interfaze);
    addUpdateByExampleWithBLOBsMethod(interfaze);
    addUpdateByExampleWithoutBLOBsMethod(interfaze);
    addUpdateByPrimaryKeySelectiveMethod(interfaze);
    addUpdateByPrimaryKeyWithBLOBsMethod(interfaze);
    addUpdateByPrimaryKeyWithoutBLOBsMethod(interfaze);

    List<CompilationUnit> answer = new ArrayList<CompilationUnit>();
    if (context.getPlugins().clientGenerated(interfaze, null,
            introspectedTable)) {
        answer.add(interfaze);
    }
    
    List<CompilationUnit> extraCompilationUnits = getExtraCompilationUnits();
    if (extraCompilationUnits != null) {
        answer.addAll(extraCompilationUnits);
    }

    return answer;
}
 
开发者ID:nextyu,项目名称:summer-mybatis-generator,代码行数:55,代码来源:JavaMapperGenerator.java

示例9: addExtraImports

import org.mybatis.generator.api.dom.java.Interface; //导入方法依赖的package包/类
@Override
public void addExtraImports(Interface interfaze) {
    interfaze.addImportedType(new FullyQualifiedJavaType("org.apache.ibatis.annotations.UpdateProvider")); //$NON-NLS-1$
}
 
开发者ID:bandaotixi,项目名称:generator_mybatis,代码行数:5,代码来源:AnnotatedUpdateByPrimaryKeySelectiveMethodGenerator.java

示例10: addMapperAnnotations

import org.mybatis.generator.api.dom.java.Interface; //导入方法依赖的package包/类
@Override
public void addMapperAnnotations(Interface interfaze, Method method) {
    interfaze.addImportedType(new FullyQualifiedJavaType("org.apache.ibatis.annotations.Select")); //$NON-NLS-1$

    StringBuilder sb = new StringBuilder();
    method.addAnnotation("@Select({"); //$NON-NLS-1$
    javaIndent(sb, 1);
    sb.append("\"select\","); //$NON-NLS-1$
    method.addAnnotation(sb.toString());
    
    Iterator<IntrospectedColumn> iter = introspectedTable
        .getAllColumns().iterator();
    sb.setLength(0);
    javaIndent(sb, 1);
    sb.append('"');
    boolean hasColumns = false;
    while (iter.hasNext()) {
        sb.append(escapeStringForJava(getSelectListPhrase(iter.next())));
        hasColumns = true;

        if (iter.hasNext()) {
            sb.append(", "); //$NON-NLS-1$
        }

        if (sb.length() > 80) {
            sb.append("\","); //$NON-NLS-1$
            method.addAnnotation(sb.toString());
            
            sb.setLength(0);
            javaIndent(sb, 1);
            sb.append('"');
            hasColumns = false;
        }
    }

    if (hasColumns) {
        sb.append("\","); //$NON-NLS-1$
        method.addAnnotation(sb.toString());
    }
    
    String orderByClause = introspectedTable.getTableConfigurationProperty(PropertyRegistry.TABLE_SELECT_ALL_ORDER_BY_CLAUSE);
    boolean hasOrderBy = StringUtility.stringHasValue(orderByClause);
    
    sb.setLength(0);
    javaIndent(sb, 1);
    sb.append("\"from "); //$NON-NLS-1$
    sb.append(escapeStringForJava(introspectedTable
            .getAliasedFullyQualifiedTableNameAtRuntime()));
    sb.append('\"');
    if (hasOrderBy) {
        sb.append(',');
    }
    method.addAnnotation(sb.toString());
    
    if (hasOrderBy) {
        sb.setLength(0);
        javaIndent(sb, 1);
        sb.append("\"order by "); //$NON-NLS-1$
        sb.append(orderByClause);
        sb.append('\"');
        method.addAnnotation(sb.toString());
    }
    
    method.addAnnotation("})"); //$NON-NLS-1$

    addAnnotatedResults(interfaze, method);
}
 
开发者ID:DomKing,项目名称:server-utility,代码行数:68,代码来源:AnnotatedSelectAllMethodGenerator.java

示例11: addExtraImports

import org.mybatis.generator.api.dom.java.Interface; //导入方法依赖的package包/类
@Override
public void addExtraImports(Interface interfaze) {
    interfaze.addImportedType(new FullyQualifiedJavaType("org.apache.ibatis.annotations.Update")); //$NON-NLS-1$
}
 
开发者ID:nextyu,项目名称:summer-mybatis-generator,代码行数:5,代码来源:AnnotatedUpdateByPrimaryKeyWithoutBLOBsMethodGenerator.java

示例12: getCompilationUnits

import org.mybatis.generator.api.dom.java.Interface; //导入方法依赖的package包/类
@Override
public List<CompilationUnit> getCompilationUnits() {
    progressCallback.startTask(getString("Progress.17", //$NON-NLS-1$
            introspectedTable.getFullyQualifiedTable().toString()));
    CommentGenerator commentGenerator = context.getCommentGenerator();

    FullyQualifiedJavaType type = new FullyQualifiedJavaType(
            introspectedTable.getMyBatis3JavaMapperType());
    Interface interfaze = new Interface(type);
    interfaze.setVisibility(JavaVisibility.PUBLIC);
    commentGenerator.addJavaFileComment(interfaze);

    String rootInterface = introspectedTable
        .getTableConfigurationProperty(PropertyRegistry.ANY_ROOT_INTERFACE);
    if (!stringHasValue(rootInterface)) {
        rootInterface = context.getJavaClientGeneratorConfiguration()
            .getProperty(PropertyRegistry.ANY_ROOT_INTERFACE);
    }

    if (stringHasValue(rootInterface)) {
        FullyQualifiedJavaType fqjt = new FullyQualifiedJavaType(
                rootInterface);
        interfaze.addSuperInterface(fqjt);
        interfaze.addImportedType(fqjt);
    }
    
    addDeleteByPrimaryKeyMethod(interfaze);
    addInsertMethod(interfaze);
    addSelectByPrimaryKeyMethod(interfaze);
    addSelectAllMethod(interfaze);
    addUpdateByPrimaryKeyMethod(interfaze);

    List<CompilationUnit> answer = new ArrayList<CompilationUnit>();
    if (context.getPlugins().clientGenerated(interfaze, null,
            introspectedTable)) {
        answer.add(interfaze);
    }
    
    List<CompilationUnit> extraCompilationUnits = getExtraCompilationUnits();
    if (extraCompilationUnits != null) {
        answer.addAll(extraCompilationUnits);
    }

    return answer;
}
 
开发者ID:DomKing,项目名称:springbootWeb,代码行数:46,代码来源:SimpleJavaClientGenerator.java

示例13: addMapperAnnotations

import org.mybatis.generator.api.dom.java.Interface; //导入方法依赖的package包/类
@Override
public void addMapperAnnotations(Interface interfaze, Method method) {
    interfaze.addImportedType(new FullyQualifiedJavaType("org.apache.ibatis.annotations.Select")); //$NON-NLS-1$

    StringBuilder sb = new StringBuilder();
    method.addAnnotation("@Select({"); //$NON-NLS-1$
    javaIndent(sb, 1);
    sb.append("\"select\","); //$NON-NLS-1$
    method.addAnnotation(sb.toString());
    
    Iterator<IntrospectedColumn> iter = introspectedTable
            .getAllColumns().iterator();
    sb.setLength(0);
    javaIndent(sb, 1);
    sb.append('"');
    boolean hasColumns = false;
    while (iter.hasNext()) {
        sb.append(escapeStringForJava(getSelectListPhrase(iter.next())));
        hasColumns = true;

        if (iter.hasNext()) {
            sb.append(", "); //$NON-NLS-1$
        }

        if (sb.length() > 80) {
            sb.append("\","); //$NON-NLS-1$
            method.addAnnotation(sb.toString());
            
            sb.setLength(0);
            javaIndent(sb, 1);
            sb.append('"');
            hasColumns = false;
        }
    }

    if (hasColumns) {
        sb.append("\","); //$NON-NLS-1$
        method.addAnnotation(sb.toString());
    }
    
    String orderByClause = introspectedTable.getTableConfigurationProperty(PropertyRegistry.TABLE_SELECT_ALL_ORDER_BY_CLAUSE);
    boolean hasOrderBy = StringUtility.stringHasValue(orderByClause);
    
    sb.setLength(0);
    javaIndent(sb, 1);
    sb.append("\"from "); //$NON-NLS-1$
    sb.append(escapeStringForJava(introspectedTable
            .getAliasedFullyQualifiedTableNameAtRuntime()));
    sb.append('\"');
    if (hasOrderBy) {
        sb.append(',');
    }
    method.addAnnotation(sb.toString());
    
    if (hasOrderBy) {
        sb.setLength(0);
        javaIndent(sb, 1);
        sb.append("\"order by "); //$NON-NLS-1$
        sb.append(orderByClause);
        sb.append('\"');
        method.addAnnotation(sb.toString());
    }
    
    method.addAnnotation("})"); //$NON-NLS-1$

    addAnnotatedResults(interfaze, method);
}
 
开发者ID:nextyu,项目名称:summer-mybatis-generator,代码行数:68,代码来源:AnnotatedSelectAllMethodGenerator.java

示例14: getCompilationUnits

import org.mybatis.generator.api.dom.java.Interface; //导入方法依赖的package包/类
@Override
public List<CompilationUnit> getCompilationUnits() {
    progressCallback.startTask(getString("Progress.17", //$NON-NLS-1$
            introspectedTable.getFullyQualifiedTable().toString()));
    CommentGenerator commentGenerator = context.getCommentGenerator();

    FullyQualifiedJavaType type = new FullyQualifiedJavaType(
            introspectedTable.getMyBatis3JavaMapperType());
    Interface interfaze = new Interface(type);
    interfaze.setVisibility(JavaVisibility.PUBLIC);
    commentGenerator.addJavaFileComment(interfaze);

    String rootInterface = introspectedTable
        .getTableConfigurationProperty(PropertyRegistry.ANY_ROOT_INTERFACE);
    if (!stringHasValue(rootInterface)) {
        rootInterface = context.getJavaClientGeneratorConfiguration()
            .getProperty(PropertyRegistry.ANY_ROOT_INTERFACE);
    }

    if (stringHasValue(rootInterface)) {
        FullyQualifiedJavaType fqjt = new FullyQualifiedJavaType(
                rootInterface);
        interfaze.addSuperInterface(fqjt);
        interfaze.addImportedType(fqjt);
    }
    
    addCountByExampleMethod(interfaze);
    addDeleteByExampleMethod(interfaze);
    addDeleteByPrimaryKeyMethod(interfaze);
    addInsertMethod(interfaze);
    addInsertSelectiveMethod(interfaze);
    addSelectByExampleWithBLOBsMethod(interfaze);
    addSelectByExampleWithoutBLOBsMethod(interfaze);
    addSelectByPrimaryKeyMethod(interfaze);
    addUpdateByExampleSelectiveMethod(interfaze);
    addUpdateByExampleWithBLOBsMethod(interfaze);
    addUpdateByExampleWithoutBLOBsMethod(interfaze);
    addUpdateByPrimaryKeySelectiveMethod(interfaze);
    addUpdateByPrimaryKeyWithBLOBsMethod(interfaze);
    addUpdateByPrimaryKeyWithoutBLOBsMethod(interfaze);

    //此处加上spring的@Repository注解,加入spring管理
    interfaze.addImportedType(new FullyQualifiedJavaType("org.springframework.stereotype.Repository"));
    interfaze.addAnnotation("@Repository");

    List<CompilationUnit> answer = new ArrayList<CompilationUnit>();
    if (context.getPlugins().clientGenerated(interfaze, null,
            introspectedTable)) {
        answer.add(interfaze);
    }
    
    List<CompilationUnit> extraCompilationUnits = getExtraCompilationUnits();
    if (extraCompilationUnits != null) {
        answer.addAll(extraCompilationUnits);
    }

    return answer;
}
 
开发者ID:DomKing,项目名称:springbootWeb,代码行数:59,代码来源:JavaMapperGenerator.java


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