本文整理了Java中org.mybatis.generator.api.dom.java.Method.addException()
方法的一些代码示例,展示了Method.addException()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Method.addException()
方法的具体详情如下:
包路径:org.mybatis.generator.api.dom.java.Method
类名称:Method
方法名:addException
[英]Adds the exception.
[中]添加异常。
代码示例来源:origin: cxjava/mybatis-generator-core
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().getCountByExampleMethodName(introspectedTable));
method.addParameter(new Parameter(type, "example")); //$NON-NLS-1$
for (FullyQualifiedJavaType fqjt : daoTemplate.getCheckedExceptions()) {
method.addException(fqjt);
importedTypes.add(fqjt);
}
return method;
}
}
代码示例来源:origin: cxjava/mybatis-generator-core
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;
}
}
代码示例来源:origin: cxjava/mybatis-generator-core
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;
}
}
代码示例来源:origin: org.mybatis.generator/mybatis-generator-core
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;
}
}
代码示例来源:origin: org.mybatis.generator/mybatis-generator-core
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;
}
}
代码示例来源:origin: roncoo/roncoo-mybatis-generator
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;
}
}
代码示例来源:origin: org.mybatis.generator/mybatis-generator-core
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;
}
}
代码示例来源:origin: roncoo/roncoo-mybatis-generator
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;
}
}
代码示例来源:origin: handosme/mybatis-generator-plus
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;
}
}
代码示例来源:origin: roncoo/roncoo-mybatis-generator
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()
.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;
}
}
代码示例来源:origin: handosme/mybatis-generator-plus
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()
.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;
}
}
代码示例来源:origin: handosme/mybatis-generator-plus
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;
}
}
代码示例来源:origin: cxjava/mybatis-generator-core
private Method getMethodShell(Set<FullyQualifiedJavaType> importedTypes) {
FullyQualifiedJavaType parameterType;
if (introspectedTable.getRules().generateRecordWithBLOBsClass()) {
parameterType = new FullyQualifiedJavaType(introspectedTable.getRecordWithBLOBsType());
} else {
parameterType = new FullyQualifiedJavaType(introspectedTable.getBaseRecordType());
}
importedTypes.add(parameterType);
Method method = new Method();
method.setVisibility(JavaVisibility.PUBLIC);
method.setReturnType(FullyQualifiedJavaType.getIntInstance());
method.setName(getDAOMethodNameCalculator().getUpdateByPrimaryKeySelectiveMethodName(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;
}
}
代码示例来源:origin: cxjava/mybatis-generator-core
private Method getMethodShell(Set<FullyQualifiedJavaType> importedTypes) {
FullyQualifiedJavaType parameterType;
if (introspectedTable.getRules().generateRecordWithBLOBsClass()) {
parameterType = new FullyQualifiedJavaType(introspectedTable.getRecordWithBLOBsType());
} else {
parameterType = new FullyQualifiedJavaType(introspectedTable.getBaseRecordType());
}
importedTypes.add(parameterType);
Method method = new Method();
method.setVisibility(JavaVisibility.PUBLIC);
method.setReturnType(FullyQualifiedJavaType.getIntInstance());
method.setName(getDAOMethodNameCalculator().getUpdateByPrimaryKeyWithBLOBsMethodName(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;
}
}
代码示例来源:origin: roncoo/roncoo-mybatis-generator
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;
}
代码示例来源:origin: org.mybatis.generator/mybatis-generator-core
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;
}
代码示例来源:origin: handosme/mybatis-generator-plus
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;
}
代码示例来源:origin: cxjava/mybatis-generator-core
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;
}
代码示例来源:origin: cxjava/mybatis-generator-core
private Method getMethodShell(Set<FullyQualifiedJavaType> importedTypes) {
FullyQualifiedJavaType parameterType;
if (introspectedTable.getRules().generateRecordWithBLOBsClass()) {
parameterType = new FullyQualifiedJavaType(introspectedTable.getRecordWithBLOBsType());
} else {
parameterType = new FullyQualifiedJavaType(introspectedTable.getBaseRecordType());
}
importedTypes.add(parameterType);
Method method = new Method();
method.setVisibility(getExampleMethodVisibility());
method.setReturnType(FullyQualifiedJavaType.getIntInstance());
method.setName(getDAOMethodNameCalculator().getUpdateByExampleWithBLOBsMethodName(introspectedTable));
method.addParameter(new Parameter(parameterType, "record")); //$NON-NLS-1$
method.addParameter(new Parameter(new FullyQualifiedJavaType(introspectedTable.getExampleType()), "example")); //$NON-NLS-1$
for (FullyQualifiedJavaType fqjt : daoTemplate.getCheckedExceptions()) {
method.addException(fqjt);
importedTypes.add(fqjt);
}
context.getCommentGenerator().addGeneralMethodComment(method, introspectedTable);
return method;
}
}
代码示例来源:origin: oceanc/mybatis3-generator-plugins
@Override
public boolean modelBaseRecordClassGenerated(TopLevelClass topLevelClass, IntrospectedTable introspectedTable) {
Method method = new Method();
method.setName("toJson");
method.setVisibility(JavaVisibility.PUBLIC);
method.setReturnType(FullyQualifiedJavaType.getStringInstance());
method.addException(new FullyQualifiedJavaType("java.io.IOException"));
method.addBodyLine("ObjectMapper mapper = new ObjectMapper();");
method.addBodyLine("mapper.setTimeZone(TimeZone.getDefault());");
method.addBodyLine("return mapper.writeValueAsString(this);");
PluginUtils.addDoc(this.getContext(), method, introspectedTable.getFullyQualifiedTableNameAtRuntime());
topLevelClass.addImportedType(new FullyQualifiedJavaType("java.io.IOException"));
topLevelClass.addImportedType(new FullyQualifiedJavaType("com.fasterxml.jackson.databind.ObjectMapper"));
topLevelClass.addImportedType(new FullyQualifiedJavaType("java.util.TimeZone"));
topLevelClass.addMethod(method);
System.out.println("-----------------" + topLevelClass.getType().getShortName() + " add method=toJson implement by Jackson2.");
return true;
}
内容来源于网络,如有侵权,请联系作者删除!