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

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

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

Method.getReturnType介绍

暂无

代码示例

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

public boolean clientInsertMethodGenerated(Method method, Interface interfaze, IntrospectedTable introspectedTable) {
    returnType = method.getReturnType();
    return true;
  }
}

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

@Override
  public boolean clientInsertMethodGenerated(Method method, Interface interfaze, IntrospectedTable introspectedTable) {
    returnType = method.getReturnType();
    return true;
  }
}

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

public boolean clientInsertMethodGenerated(Method method, Interface interfaze, IntrospectedTable introspectedTable) {
    returnType = method.getReturnType();
    return true;
  }
}

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

} else {
  m.setName(it.getName());
  m.setReturnType(it.getReturnType());
  topLevelClazz.addImportedType(it.getReturnType());
  String bodyline = "return mapper.";
  bodyline += m.getName();

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

@Override
public boolean clientBasicSelectManyMethodGenerated(Method method, Interface interfaze,
    IntrospectedTable introspectedTable) {
  copyAndAddSelectManyMethod(method, interfaze);
  
  addNewComposedFunction(interfaze, introspectedTable, method.getReturnType());
  return true;
}

代码示例来源:origin: io.github.cgi/mybatis-generator-plugins

private Method generateDecoratedProviderMethod(Method method, TopLevelClass topLevelClass,
                        IntrospectedTable introspectedTable) {
  Method m = new Method(config.methodToGenerateName);
  m.setVisibility(method.getVisibility());
  m.setReturnType(method.getReturnType());
  List<Parameter> params = method.getParameters();
  for (Parameter p : params) {
    m.addParameter(p);
  }
  StringBuilder sb =
      new StringBuilder("String sql = ")
          .append("this.").append(method.getName()).append("(");
  for (Parameter p : params) {
    sb.append(p.getName());
    sb.append(",");
  }
  sb.deleteCharAt(sb.length() - 1);
  sb.append(");");
  m.addBodyLine(sb.toString());
  m.addBodyLine("return \"" + config.sql + "\".replace(\"#{methodToDecorate}\", sql);");
  return m;
}

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

@Override
public void addImplementationElements(TopLevelClass topLevelClass) {
  Set<FullyQualifiedJavaType> importedTypes = new TreeSet<FullyQualifiedJavaType>();
  Method method = getMethodShell(importedTypes);
  if (generateForJava5) {
    method.addSuppressTypeWarningsAnnotation();
  }
  StringBuilder sb = new StringBuilder();
  sb.append(method.getReturnType().getShortName());
  sb.append(" list = "); //$NON-NLS-1$
  sb.append(daoTemplate.getQueryForListMethod(introspectedTable
      .getIbatis2SqlMapNamespace(), introspectedTable
      .getSelectByExampleStatementId(), "example")); //$NON-NLS-1$
  method.addBodyLine(sb.toString());
  method.addBodyLine("return list;"); //$NON-NLS-1$
  if (context.getPlugins()
      .clientSelectByExampleWithoutBLOBsMethodGenerated(method,
          topLevelClass, introspectedTable)) {
    topLevelClass.addImportedTypes(importedTypes);
    topLevelClass.addMethod(method);
  }
}

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

@Override
public void addImplementationElements(TopLevelClass topLevelClass) {
  Set<FullyQualifiedJavaType> importedTypes = new TreeSet<FullyQualifiedJavaType>();
  Method method = getMethodShell(importedTypes);
  if (generateForJava5) {
    method.addSuppressTypeWarningsAnnotation();
  }
  StringBuilder sb = new StringBuilder();
  sb.append(method.getReturnType().getShortName());
  sb.append(" list = "); //$NON-NLS-1$
  sb.append(daoTemplate.getQueryForListMethod(introspectedTable
      .getIbatis2SqlMapNamespace(), introspectedTable
      .getSelectByExampleWithBLOBsStatementId(), "example")); //$NON-NLS-1$
  method.addBodyLine(sb.toString());
  method.addBodyLine("return list;"); //$NON-NLS-1$
  if (context.getPlugins()
      .clientSelectByExampleWithBLOBsMethodGenerated(method,
          topLevelClass, introspectedTable)) {
    topLevelClass.addImportedTypes(importedTypes);
    topLevelClass.addMethod(method);
  }
}

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

@Override
public void addImplementationElements(TopLevelClass topLevelClass) {
  Set<FullyQualifiedJavaType> importedTypes = new TreeSet<FullyQualifiedJavaType>();
  Method method = getMethodShell(importedTypes);
  if (generateForJava5) {
    method.addSuppressTypeWarningsAnnotation();
  }
  StringBuilder sb = new StringBuilder();
  sb.append(method.getReturnType().getShortName());
  sb.append(" list = "); //$NON-NLS-1$
  sb.append(daoTemplate.getQueryForListMethod(introspectedTable.getIbatis2SqlMapNamespace(),
      introspectedTable.getSelectByExampleStatementId(), "example")); //$NON-NLS-1$
  method.addBodyLine(sb.toString());
  method.addBodyLine("return list;"); //$NON-NLS-1$
  if (context.getPlugins().clientSelectByExampleWithoutBLOBsMethodGenerated(method, topLevelClass,
      introspectedTable)) {
    topLevelClass.addImportedTypes(importedTypes);
    topLevelClass.addMethod(method);
  }
}

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

@Override
public void addImplementationElements(TopLevelClass topLevelClass) {
  Set<FullyQualifiedJavaType> importedTypes = new TreeSet<FullyQualifiedJavaType>();
  Method method = getMethodShell(importedTypes);
  if (generateForJava5) {
    method.addSuppressTypeWarningsAnnotation();
  }
  StringBuilder sb = new StringBuilder();
  sb.append(method.getReturnType().getShortName());
  sb.append(" list = "); //$NON-NLS-1$
  sb.append(daoTemplate.getQueryForListMethod(introspectedTable.getIbatis2SqlMapNamespace(),
      introspectedTable.getSelectByExampleWithBLOBsStatementId(), "example")); //$NON-NLS-1$
  method.addBodyLine(sb.toString());
  method.addBodyLine("return list;"); //$NON-NLS-1$
  if (context.getPlugins()
      .clientSelectByExampleWithBLOBsMethodGenerated(method, topLevelClass, introspectedTable)) {
    topLevelClass.addImportedTypes(importedTypes);
    topLevelClass.addMethod(method);
  }
}

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

@Override
public void addImplementationElements(TopLevelClass topLevelClass) {
  Set<FullyQualifiedJavaType> importedTypes = new TreeSet<FullyQualifiedJavaType>();
  Method method = getMethodShell(importedTypes);
  if (generateForJava5) {
    method.addSuppressTypeWarningsAnnotation();
  }
  StringBuilder sb = new StringBuilder();
  sb.append(method.getReturnType().getShortName());
  sb.append(" list = "); //$NON-NLS-1$
  sb.append(daoTemplate.getQueryForListMethod(introspectedTable
      .getIbatis2SqlMapNamespace(), introspectedTable
      .getSelectByExampleStatementId(), "example")); //$NON-NLS-1$
  method.addBodyLine(sb.toString());
  method.addBodyLine("return list;"); //$NON-NLS-1$
  if (context.getPlugins()
      .clientSelectByExampleWithoutBLOBsMethodGenerated(method,
          topLevelClass, introspectedTable)) {
    topLevelClass.addImportedTypes(importedTypes);
    topLevelClass.addMethod(method);
  }
}

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

@Override
public void addImplementationElements(TopLevelClass topLevelClass) {
  Set<FullyQualifiedJavaType> importedTypes = new TreeSet<FullyQualifiedJavaType>();
  Method method = getMethodShell(importedTypes);
  if (generateForJava5) {
    method.addSuppressTypeWarningsAnnotation();
  }
  StringBuilder sb = new StringBuilder();
  sb.append(method.getReturnType().getShortName());
  sb.append(" list = "); //$NON-NLS-1$
  sb.append(daoTemplate.getQueryForListMethod(introspectedTable
      .getIbatis2SqlMapNamespace(), introspectedTable
      .getSelectByExampleWithBLOBsStatementId(), "example")); //$NON-NLS-1$
  method.addBodyLine(sb.toString());
  method.addBodyLine("return list;"); //$NON-NLS-1$
  if (context.getPlugins()
      .clientSelectByExampleWithBLOBsMethodGenerated(method,
          topLevelClass, introspectedTable)) {
    topLevelClass.addImportedTypes(importedTypes);
    topLevelClass.addMethod(method);
  }
}

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

@Override
public void addImplementationElements(TopLevelClass topLevelClass) {
  Set<FullyQualifiedJavaType> importedTypes = new TreeSet<FullyQualifiedJavaType>();
  Method method = getMethodShell(importedTypes);
  if (generateForJava5) {
    method.addAnnotation("@Override"); //$NON-NLS-1$
    method.addSuppressTypeWarningsAnnotation();
  }
  StringBuilder sb = new StringBuilder();
  sb.append(method.getReturnType().getShortName());
  sb.append(" list = "); //$NON-NLS-1$
  sb.append(daoTemplate.getQueryForListMethod(introspectedTable
      .getIbatis2SqlMapNamespace(), introspectedTable
      .getSelectByExampleWithBLOBsStatementId(), "example")); //$NON-NLS-1$
  method.addBodyLine(sb.toString());
  method.addBodyLine("return list;"); //$NON-NLS-1$
  if (context.getPlugins()
      .clientSelectByExampleWithBLOBsMethodGenerated(method,
          topLevelClass, introspectedTable)) {
    topLevelClass.addImportedTypes(importedTypes);
    topLevelClass.addMethod(method);
  }
}

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

@Override
public void addImplementationElements(TopLevelClass topLevelClass) {
  Set<FullyQualifiedJavaType> importedTypes = new TreeSet<FullyQualifiedJavaType>();
  Method method = getMethodShell(importedTypes);
  if (generateForJava5) {
    method.addSuppressTypeWarningsAnnotation();
    method.addAnnotation("@Override"); //$NON-NLS-1$
  }
  StringBuilder sb = new StringBuilder();
  sb.append(method.getReturnType().getShortName());
  sb.append(" list = "); //$NON-NLS-1$
  sb.append(daoTemplate.getQueryForListMethod(introspectedTable
      .getIbatis2SqlMapNamespace(), introspectedTable
      .getSelectByExampleStatementId(), "example")); //$NON-NLS-1$
  method.addBodyLine(sb.toString());
  method.addBodyLine("return list;"); //$NON-NLS-1$
  if (context.getPlugins()
      .clientSelectByExampleWithoutBLOBsMethodGenerated(method,
          topLevelClass, introspectedTable)) {
    topLevelClass.addImportedTypes(importedTypes);
    topLevelClass.addMethod(method);
  }
}

代码示例来源:origin: io.github.cgi/mybatis-generator-plugins

private Method generateDecoratedMapperMethod(Method method, IntrospectedTable introspectedTable) {
  Method methodToGenerate = new Method(config.methodToGenerateName);
  methodToGenerate.setVisibility(method.getVisibility());
  methodToGenerate.setReturnType(method.getReturnType());
  context.getCommentGenerator().addGeneralMethodComment(methodToGenerate, introspectedTable);
  List<String> annotations = method.getAnnotations();
  for (String a : annotations) {
    if (a.matches("@.*Provider.*")) {
      methodToGenerate.addAnnotation(a.replace(config.methodToDecorateName, config.methodToGenerateName));
    } else
      methodToGenerate.addAnnotation(a);
  }
  List<Parameter> params = method.getParameters();
  for (Parameter p : params) {
    methodToGenerate.addParameter(p);
  }
  return methodToGenerate;
}

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

/**
 * Rename the method types.
 *
 * @param method
 *            the method
 * @return true
 */
boolean renameMethod(Method method) {
  method.setReturnType(modelProperties.renameType(method.getReturnType()));
  for (int i = 0; i < method.getParameters().size(); i++) {
    Parameter parameter = method.getParameters().get(i);
    FullyQualifiedJavaType parameterType = parameter.getType();
    FullyQualifiedJavaType newParameterType = modelProperties.renameType(parameterType);
    if (parameterType != newParameterType) {
      Parameter newParam = new Parameter(newParameterType, parameter.getName(), parameter.isVarargs());
      for (String annotation : parameter.getAnnotations()) {
        newParam.addAnnotation(annotation);
      }
      method.getParameters().set(i, newParam);
      log.debug("set new parameter: [{}][{}]", parameter, newParam);
    }
  }
  modelProperties.renameAnnotations(method.getAnnotations());
  mapperProperties.renameAnnotations(method.getAnnotations());
  return true;
}

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

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;
}

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

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;
}

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

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;
}

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

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;
}

相关文章