org.mybatis.generator.api.dom.java.Method.setReturnType()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(9.8k)|赞(0)|评价(0)|浏览(158)

本文整理了Java中org.mybatis.generator.api.dom.java.Method.setReturnType()方法的一些代码示例,展示了Method.setReturnType()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Method.setReturnType()方法的具体详情如下:
包路径:org.mybatis.generator.api.dom.java.Method
类名称:Method
方法名:setReturnType

Method.setReturnType介绍

暂无

代码示例

代码示例来源:origin: abel533/Mapper

defaultMethod.setName("defaultInstance");
defaultMethod.setVisibility(JavaVisibility.PUBLIC);
defaultMethod.setReturnType(topLevelClass.getType());
defaultMethod.addBodyLine(String.format("%s instance = new %s();", topLevelClass.getType().getShortName(), topLevelClass.getType().getShortName()));
for (IntrospectedColumn introspectedColumn : introspectedTable.getAllColumns()) {

代码示例来源:origin: abel533/Mapper

defaultMethod.setName("defaultInstance");
defaultMethod.setVisibility(JavaVisibility.PUBLIC);
defaultMethod.setReturnType(topLevelClass.getType());
defaultMethod.addBodyLine(String.format("%s instance = new %s();", topLevelClass.getType().getShortName(), topLevelClass.getType().getShortName()));
for (IntrospectedColumn introspectedColumn : introspectedTable.getAllColumns()) {

代码示例来源:origin: shuzheng/zheng

getLimit.setReturnType(integerWrapper);
getLimit.setName("getLimit");
getLimit.addBodyLine("return limit;");
getOffset.setReturnType(integerWrapper);
getOffset.setName("getOffset");
getOffset.addBodyLine("return offset;");

代码示例来源:origin: jmdhappy/xxpay-master

getLimit.setReturnType(integerWrapper);
getLimit.setName("getLimit");
getLimit.addBodyLine("return limit;");
getOffset.setReturnType(integerWrapper);
getOffset.setName("getOffset");
getOffset.addBodyLine("return offset;");

代码示例来源:origin: jmdhappy/xxpay-master

getLimit.setReturnType(integerWrapper);
getLimit.setName("getLimit");
getLimit.addBodyLine("return limit;");
getOffset.setReturnType(integerWrapper);
getOffset.setName("getOffset");
getOffset.addBodyLine("return offset;");

代码示例来源:origin: sanluan/PublicCMS

m.setName(it.getName().replace("WithRowbounds", "WithPage"));
  FullyQualifiedJavaType pageHandler = new FullyQualifiedJavaType("com.publiccms.common.handler.PageHandler");
  m.setReturnType(pageHandler);
  topLevelClazz.addImportedType(pageHandler);
  m.addBodyLine(
} else {
  m.setName(it.getName());
  m.setReturnType(it.getReturnType());
  topLevelClazz.addImportedType(it.getReturnType());
  String bodyline = "return mapper.";

代码示例来源:origin: MisterChangRay/mybatis-generator-plugins

@Override
public boolean modelSetterMethodGenerated(Method method, TopLevelClass topLevelClass, IntrospectedColumn introspectedColumn, IntrospectedTable introspectedTable, ModelClassType modelClassType) {
  method.setReturnType(topLevelClass.getType());
  method.addBodyLine("return this;");
  logger.debug("Setter扩展完成");
  return super.modelSetterMethodGenerated(method, topLevelClass, introspectedColumn, introspectedTable, modelClassType);
}

代码示例来源:origin: oceanc/mybatis3-generator-plugins

public static Method makeGetterStringMethod(Context context, String fieldName, FullyQualifiedJavaType fieldType, String tableName) {
  String methodName = "get" + fieldName.substring(0, 1).toUpperCase() + fieldName.substring(1, fieldName.length());
  Method method = new Method();
  method.setName(methodName);
  method.setVisibility(JavaVisibility.PUBLIC);
  method.setReturnType(fieldType);
  method.addBodyLine("return this." + fieldName + ";");
  addDoc(context, method, tableName);
  return method;
}

代码示例来源:origin: oceanc/mybatis3-generator-plugins

private Method makePartitionMethod(FullyQualifiedJavaType paramType, FullyQualifiedJavaType returnType, String fieldName, String tableName, String[] exp) {
  String methodName = PARTITION_FACTOR + fieldName.substring(0, 1).toUpperCase() + fieldName.substring(1, fieldName.length());
  Method method = new Method();
  method.setName(methodName);
  method.setVisibility(JavaVisibility.PUBLIC);
  method.setReturnType(returnType);
  method.addBodyLines(Arrays.asList(exp));
  method.addParameter(new Parameter(paramType, fieldName));
  PluginUtils.addDoc(this.getContext(), method, tableName);
  return method;
}

代码示例来源:origin: cxjava/mybatis-generator-core

public static Method getGetter(Field field) {
  Method method = new Method();
  method.setName(getGetterMethodName(field.getName(), field.getType()));
  method.setReturnType(field.getType());
  method.setVisibility(JavaVisibility.PUBLIC);
  StringBuilder sb = new StringBuilder();
  sb.append("return "); //$NON-NLS-1$
  sb.append(field.getName());
  sb.append(';');
  method.addBodyLine(sb.toString());
  return method;
}

代码示例来源:origin: org.mybatis.generator/mybatis-generator-core

public static Method getGetter(Field field) {
  Method method = new Method();
  method.setName(getGetterMethodName(field.getName(), field
      .getType()));
  method.setReturnType(field.getType());
  method.setVisibility(JavaVisibility.PUBLIC);
  StringBuilder sb = new StringBuilder();
  sb.append("return "); //$NON-NLS-1$
  sb.append(field.getName());
  sb.append(';');
  method.addBodyLine(sb.toString());
  return method;
}

代码示例来源:origin: roncoo/roncoo-mybatis-generator

public static Method getGetter(Field field) {
  Method method = new Method();
  method.setName(getGetterMethodName(field.getName(), field
      .getType()));
  method.setReturnType(field.getType());
  method.setVisibility(JavaVisibility.PUBLIC);
  StringBuilder sb = new StringBuilder();
  sb.append("return "); //$NON-NLS-1$
  sb.append(field.getName());
  sb.append(';');
  method.addBodyLine(sb.toString());
  return method;
}

代码示例来源:origin: handosme/mybatis-generator-plus

public static Method getGetter(Field field) {
  Method method = new Method();
  method.setName(getGetterMethodName(field.getName(), field
      .getType()));
  method.setReturnType(field.getType());
  method.setVisibility(JavaVisibility.PUBLIC);
  StringBuilder sb = new StringBuilder();
  sb.append("return "); //$NON-NLS-1$
  sb.append(field.getName());
  sb.append(';');
  method.addBodyLine(sb.toString());
  return method;
}

代码示例来源:origin: beihaifeiwu/dolphin

@Override
public boolean clientGenerated(Interface interfaze, TopLevelClass topLevelClass, IntrospectedTable introspectedTable) {
 Set<FullyQualifiedJavaType> importedTypes = new TreeSet<>();
 Method method = new Method(BATCH_UPDATE);
 FullyQualifiedJavaType type = new FullyQualifiedJavaType("java.util.List<" + introspectedTable.getTableConfiguration().getDomainObjectName() + ">");
 method.addParameter(new Parameter(type, "list"));
 method.setReturnType(FullyQualifiedJavaType.getIntInstance());
 importedTypes.add(type);
 interfaze.addMethod(method);
 interfaze.addImportedTypes(importedTypes);
 return true;
}

代码示例来源:origin: beihaifeiwu/dolphin

protected void generateFluentGetterFor(String field, FullyQualifiedJavaType type, InnerClass innerClass) {
 Method method = new Method();
 method.setVisibility(JavaVisibility.PUBLIC);
 method.setName(field);
 method.addBodyLine("return this." + field + ";");
 method.setReturnType(type);
 innerClass.addMethod(method);
}

代码示例来源:origin: beihaifeiwu/dolphin

protected void generateGetterFor(String field, FullyQualifiedJavaType type, InnerClass innerClass) {
 Method method = new Method();
 method.setVisibility(JavaVisibility.PUBLIC);
 method.setName("get" + capitalize(field));
 method.setReturnType(type);
 method.addBodyLine("return this." + field + ";");
 innerClass.addMethod(method);
}

代码示例来源:origin: oceanc/mybatis3-generator-plugins

@Override
public boolean clientGenerated(Interface interfaze, TopLevelClass topLevelClass, IntrospectedTable introspectedTable) {
  FullyQualifiedJavaType paramType = new FullyQualifiedJavaType(introspectedTable.getExampleType());
  Method method = new Method();
  method.setName("sumByExample");
  method.setVisibility(JavaVisibility.PUBLIC);
  method.addParameter(new Parameter(paramType, "example"));
  method.setReturnType(LONG_TYPE);
  interfaze.addMethod(method);
  System.out.println("-----------------" + interfaze.getType().getShortName() + " add method sumByExample.");
  return true;
}

代码示例来源:origin: beihaifeiwu/dolphin

@Override
public boolean clientGenerated(Interface interfaze, TopLevelClass topLevelClass, IntrospectedTable introspectedTable) {
 String objectName = introspectedTable.getTableConfiguration().getDomainObjectName();
 Method method = new Method(BATCH_INSERT);
 FullyQualifiedJavaType type = new FullyQualifiedJavaType("java.util.List<" + objectName + ">");
 method.addParameter(new Parameter(type, "list"));
 method.setReturnType(FullyQualifiedJavaType.getIntInstance());
 interfaze.addMethod(method);
 return true;
}

代码示例来源:origin: beihaifeiwu/dolphin

protected void generateFluentSetterFor(String field, FullyQualifiedJavaType type, InnerClass innerClass) {
 Method method = new Method();
 method.setVisibility(JavaVisibility.PUBLIC);
 method.setName(field);
 method.addParameter(new Parameter(type, field));
 method.addBodyLine("this." + field + " = " + field + ";");
 method.addBodyLine("return this;");
 method.setReturnType(innerClass.getType());
 innerClass.addMethod(method);
}

代码示例来源:origin: org.mybatis.generator/mybatis-generator-core

private void addNewComposedFunction(Interface interfaze, IntrospectedTable introspectedTable, FullyQualifiedJavaType baseMethodReturnType) {
  interfaze.addImportedType(new FullyQualifiedJavaType("java.util.function.Function")); //$NON-NLS-1$
  
  FullyQualifiedJavaType returnType = new FullyQualifiedJavaType("Function<SelectStatementProvider, " //$NON-NLS-1$
      + baseMethodReturnType.getShortName() + ">"); //$NON-NLS-1$
  
  Method method = new Method("selectManyWithRowbounds"); //$NON-NLS-1$
  method.setDefault(true);
  method.setReturnType(returnType);
  method.addParameter(new Parameter(rowBounds, "rowBounds")); //$NON-NLS-1$
  method.addBodyLine("return selectStatement -> selectManyWithRowbounds(selectStatement, rowBounds);"); //$NON-NLS-1$
  context.getCommentGenerator().addGeneralMethodAnnotation(method, introspectedTable, interfaze.getImportedTypes());
  interfaze.addMethod(method);
}

相关文章