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


Java Method.addException方法代码示例

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


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

示例1: getConstructorClone

import org.mybatis.generator.api.dom.java.Method; //导入方法依赖的package包/类
/**
 * Gets the constructor clone.
 *
 * @param commentGenerator
 *            the comment generator
 * @param type
 *            the type
 * @param introspectedTable
 *            the introspected table
 * @return the constructor clone
 */
public final Method getConstructorClone(CommentGenerator commentGenerator,
        FullyQualifiedJavaType type, IntrospectedTable introspectedTable) {
    configure();
    Method answer = new Method();
    answer.setConstructor(true);
    answer.setName(type.getShortName());
    answer.setVisibility(constructorTemplate.getVisibility());
    for (Parameter parm : constructorTemplate.getParameters()) {
        answer.addParameter(parm);
    }

    for (String bodyLine : constructorTemplate.getBodyLines()) {
        answer.addBodyLine(bodyLine);
    }

    for (FullyQualifiedJavaType fqjt : constructorTemplate.getExceptions()) {
        answer.addException(fqjt);
    }

    commentGenerator.addGeneralMethodComment(answer, introspectedTable);

    return answer;
}
 
开发者ID:bandaotixi,项目名称:generator_mybatis,代码行数:35,代码来源:AbstractDAOTemplate.java

示例2: getMethodShell

import org.mybatis.generator.api.dom.java.Method; //导入方法依赖的package包/类
private Method getMethodShell(Set<FullyQualifiedJavaType> importedTypes) {
    FullyQualifiedJavaType type = new FullyQualifiedJavaType(
            introspectedTable.getExampleType());
    importedTypes.add(type);

    Method method = new Method();
    method.setVisibility(getExampleMethodVisibility());
    method.setReturnType(FullyQualifiedJavaType.getIntInstance());
    method.setName(getDAOMethodNameCalculator()
            .getDeleteByExampleMethodName(introspectedTable));
    method.addParameter(new Parameter(type, "example")); //$NON-NLS-1$

    for (FullyQualifiedJavaType fqjt : daoTemplate.getCheckedExceptions()) {
        method.addException(fqjt);
        importedTypes.add(fqjt);
    }

    context.getCommentGenerator().addGeneralMethodComment(method,
            introspectedTable);

    return method;
}
 
开发者ID:bandaotixi,项目名称:generator_mybatis,代码行数:23,代码来源:DeleteByExampleMethodGenerator.java

示例3: getMethodShell

import org.mybatis.generator.api.dom.java.Method; //导入方法依赖的package包/类
private Method getMethodShell(Set<FullyQualifiedJavaType> importedTypes) {
    FullyQualifiedJavaType type = new FullyQualifiedJavaType(
            introspectedTable.getExampleType());
    importedTypes.add(type);

    Method method = new Method();
    method.setVisibility(getExampleMethodVisibility());
    method.setReturnType(new FullyQualifiedJavaType("long")); //$NON-NLS-1$
    method.setName(getDAOMethodNameCalculator()
            .getCountByExampleMethodName(introspectedTable));
    method.addParameter(new Parameter(type, "example")); //$NON-NLS-1$

    for (FullyQualifiedJavaType fqjt : daoTemplate.getCheckedExceptions()) {
        method.addException(fqjt);
        importedTypes.add(fqjt);
    }

    context.getCommentGenerator().addGeneralMethodComment(method,
            introspectedTable);

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

示例4: getMethodShell

import org.mybatis.generator.api.dom.java.Method; //导入方法依赖的package包/类
private Method getMethodShell(Set<FullyQualifiedJavaType> importedTypes) {
    FullyQualifiedJavaType parameterType = new FullyQualifiedJavaType(
            introspectedTable.getBaseRecordType());
    importedTypes.add(parameterType);

    Method method = new Method();
    method.setVisibility(JavaVisibility.PUBLIC);
    method.setReturnType(FullyQualifiedJavaType.getIntInstance());
    method
            .setName(getDAOMethodNameCalculator()
                    .getUpdateByPrimaryKeyWithoutBLOBsMethodName(
                            introspectedTable));
    method.addParameter(new Parameter(parameterType, "record")); //$NON-NLS-1$

    for (FullyQualifiedJavaType fqjt : daoTemplate.getCheckedExceptions()) {
        method.addException(fqjt);
        importedTypes.add(fqjt);
    }

    context.getCommentGenerator().addGeneralMethodComment(method,
            introspectedTable);

    return method;
}
 
开发者ID:bandaotixi,项目名称:generator_mybatis,代码行数:25,代码来源:UpdateByPrimaryKeyWithoutBLOBsMethodGenerator.java

示例5: clientUpdateByPrimaryKeySelectiveMethodGenerated

import org.mybatis.generator.api.dom.java.Method; //导入方法依赖的package包/类
@Override
public boolean clientUpdateByPrimaryKeySelectiveMethodGenerated(
        Method method, Interface interfaze,
        IntrospectedTable introspectedTable) {
    if (ignore(introspectedTable)) {
        return true;
    }

    Method m = new Method();
    m.setName("updateByPrimaryKeySelectiveWithVersion");
    copyMethod(m, method, null);
    m.addParameter(new Parameter(new FullyQualifiedJavaType(
            "java.lang.Integer"), "version", "@Param(\"version\")"));
    m.addException(new FullyQualifiedJavaType(optimisticLockException));

    interfaze.addMethod(m);
    interfaze.addImportedType(new FullyQualifiedJavaType(optimisticLockException));
    return true;
}
 
开发者ID:ling49043171,项目名称:mark-mybatis-generator,代码行数:20,代码来源:OptimisticLockMethodPlugin.java

示例6: getMethodClones

import org.mybatis.generator.api.dom.java.Method; //导入方法依赖的package包/类
/**
 * Gets the method clones.
 *
 * @param commentGenerator
 *            the comment generator
 * @param introspectedTable
 *            the introspected table
 * @return the method clones
 */
public final List<Method> getMethodClones(
        CommentGenerator commentGenerator,
        IntrospectedTable introspectedTable) {
    configure();
    List<Method> answer = new ArrayList<Method>();
    for (Method oldMethod : methods) {
        Method method = new Method();

        for (String bodyLine : oldMethod.getBodyLines()) {
            method.addBodyLine(bodyLine);
        }

        for (FullyQualifiedJavaType fqjt : oldMethod.getExceptions()) {
            method.addException(fqjt);
        }

        for (Parameter parm : oldMethod.getParameters()) {
            method.addParameter(parm);
        }

        method.setConstructor(oldMethod.isConstructor());
        method.setFinal(oldMethod.isFinal());
        method.setStatic(oldMethod.isStatic());
        method.setName(oldMethod.getName());
        method.setReturnType(oldMethod.getReturnType());
        method.setVisibility(oldMethod.getVisibility());

        commentGenerator.addGeneralMethodComment(method, introspectedTable);

        answer.add(method);
    }

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

示例7: getMethodShell

import org.mybatis.generator.api.dom.java.Method; //导入方法依赖的package包/类
private Method getMethodShell(Set<FullyQualifiedJavaType> importedTypes) {
    Method method = new Method();

    FullyQualifiedJavaType returnType;
    if (introspectedTable.getGeneratedKey() != null) {
        IntrospectedColumn introspectedColumn = introspectedTable
                .getColumn(introspectedTable.getGeneratedKey().getColumn());
        if (introspectedColumn == null) {
            // the specified column doesn't exist, so don't do the generated
            // key
            // (the warning has already been reported)
            returnType = null;
        } else {
            returnType = introspectedColumn.getFullyQualifiedJavaType();
            importedTypes.add(returnType);
        }
    } else {
        returnType = null;
    }
    method.setReturnType(returnType);
    method.setVisibility(JavaVisibility.PUBLIC);
    method.setName(getDAOMethodNameCalculator()
            .getInsertSelectiveMethodName(introspectedTable));

    FullyQualifiedJavaType parameterType = introspectedTable.getRules()
            .calculateAllFieldsClass();

    importedTypes.add(parameterType);
    method.addParameter(new Parameter(parameterType, "record")); //$NON-NLS-1$

    for (FullyQualifiedJavaType fqjt : daoTemplate.getCheckedExceptions()) {
        method.addException(fqjt);
        importedTypes.add(fqjt);
    }

    context.getCommentGenerator().addGeneralMethodComment(method,
            introspectedTable);

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

示例8: getMethodShell

import org.mybatis.generator.api.dom.java.Method; //导入方法依赖的package包/类
private Method getMethodShell(Set<FullyQualifiedJavaType> importedTypes) {
    Method method = new Method();

    FullyQualifiedJavaType returnType;
    if (introspectedTable.getGeneratedKey() != null) {
        IntrospectedColumn introspectedColumn = introspectedTable
                .getColumn(introspectedTable.getGeneratedKey().getColumn());
        if (introspectedColumn == null) {
            // the specified column doesn't exist, so don't do the generated
            // key
            // (the warning has already been reported)
            returnType = null;
        } else {
            returnType = introspectedColumn.getFullyQualifiedJavaType();
            importedTypes.add(returnType);
        }
    } else {
        returnType = null;
    }

    method.setReturnType(returnType);
    method.setVisibility(JavaVisibility.PUBLIC);
    DAOMethodNameCalculator methodNameCalculator = getDAOMethodNameCalculator();
    method.setName(methodNameCalculator
            .getInsertMethodName(introspectedTable));

    FullyQualifiedJavaType parameterType = introspectedTable.getRules()
            .calculateAllFieldsClass();

    importedTypes.add(parameterType);
    method.addParameter(new Parameter(parameterType, "record")); //$NON-NLS-1$

    for (FullyQualifiedJavaType fqjt : daoTemplate.getCheckedExceptions()) {
        method.addException(fqjt);
        importedTypes.add(fqjt);
    }

    context.getCommentGenerator().addGeneralMethodComment(method,
            introspectedTable);

    return method;
}
 
开发者ID:xiachengwei5,项目名称:org.mybatis.generator.core-1.3.5,代码行数:43,代码来源:InsertMethodGenerator.java


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