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

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

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

Method.addBodyLine介绍

[英]Adds the body line.
[中]添加主体线条。

代码示例

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

setLimit.setName("setLimit");
setLimit.addParameter(new Parameter(integerWrapper, "limit"));
setLimit.addBodyLine("this.limit = limit;");
topLevelClass.addMethod(setLimit);
getLimit.setReturnType(integerWrapper);
getLimit.setName("getLimit");
getLimit.addBodyLine("return limit;");
topLevelClass.addMethod(getLimit);
setOffset.setName("setOffset");
setOffset.addParameter(new Parameter(integerWrapper, "offset"));
setOffset.addBodyLine("this.offset = offset;");
topLevelClass.addMethod(setOffset);
getOffset.setReturnType(integerWrapper);
getOffset.setName("getOffset");
getOffset.addBodyLine("return offset;");
topLevelClass.addMethod(getOffset);

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

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()) {
  String shortName = introspectedColumn.getFullyQualifiedJavaType().getShortName();
    defaultMethod.addBodyLine(String.format("instance.%s = new %s(\"%s\");", introspectedColumn.getJavaProperty(), shortName, defaultValue));
defaultMethod.addBodyLine("return instance;");
topLevelClass.addMethod(defaultMethod);

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

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()) {
  String shortName = introspectedColumn.getFullyQualifiedJavaType().getShortName();
    defaultMethod.addBodyLine(String.format("instance.%s = new %s(\"%s\");", introspectedColumn.getJavaProperty(), shortName, defaultValue));
defaultMethod.addBodyLine("return instance;");
topLevelClass.addMethod(defaultMethod);

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

setLimit.setName("setLimit");
setLimit.addParameter(new Parameter(integerWrapper, "limit"));
setLimit.addBodyLine("this.limit = limit;");
topLevelClass.addMethod(setLimit);
getLimit.setReturnType(integerWrapper);
getLimit.setName("getLimit");
getLimit.addBodyLine("return limit;");
topLevelClass.addMethod(getLimit);
setOffset.setName("setOffset");
setOffset.addParameter(new Parameter(integerWrapper, "offset"));
setOffset.addBodyLine("this.offset = offset;");
topLevelClass.addMethod(setOffset);
getOffset.setReturnType(integerWrapper);
getOffset.setName("getOffset");
getOffset.addBodyLine("return offset;");
topLevelClass.addMethod(getOffset);

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

setLimit.setName("setLimit");
setLimit.addParameter(new Parameter(integerWrapper, "limit"));
setLimit.addBodyLine("this.limit = limit;");
topLevelClass.addMethod(setLimit);
getLimit.setReturnType(integerWrapper);
getLimit.setName("getLimit");
getLimit.addBodyLine("return limit;");
topLevelClass.addMethod(getLimit);
setOffset.setName("setOffset");
setOffset.addParameter(new Parameter(integerWrapper, "offset"));
setOffset.addBodyLine("this.offset = offset;");
topLevelClass.addMethod(setOffset);
getOffset.setReturnType(integerWrapper);
getOffset.setName("getOffset");
getOffset.addBodyLine("return offset;");
topLevelClass.addMethod(getOffset);

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

m.setReturnType(pageHandler);
  topLevelClazz.addImportedType(pageHandler);
  m.addBodyLine(
      "PageHandler page = new PageHandler(pageIndex, pageSize, mapper.countByExample(example), null);");
  StringBuilder bodyline = new StringBuilder();
  m.addBodyLine(bodyline.toString());
  m.addBodyLine("return page;");
} else {
  m.setName(it.getName());
  m.addBodyLine(bodyline);

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

@Override
public boolean modelGetterMethodGenerated(Method method, TopLevelClass topLevelClass,
    IntrospectedColumn introspectedColumn, IntrospectedTable introspectedTable, ModelClassType modelClassType) {
  if (tableMatches(introspectedTable) && gettersToWrap.contains(method.getName())) {
    method.getBodyLines().clear();
    method.addBodyLine(String.format("return this.%s.%s();", objectFieldName, wrappedGetters.get(method.getName())));
  }
  return true;
}

代码示例来源: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: org.mybatis.generator/mybatis-generator-core

@Override
protected void configureConstructorTemplate() {
  Method constructor = new Method();
  constructor.setConstructor(true);
  constructor.setVisibility(JavaVisibility.PUBLIC);
  constructor
      .addParameter(new Parameter(sqlMapClientType, "sqlMapClient")); //$NON-NLS-1$
  constructor.addBodyLine("super();"); //$NON-NLS-1$
  constructor.addBodyLine("this.sqlMapClient = sqlMapClient;"); //$NON-NLS-1$
  setConstructorTemplate(constructor);
}

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

@Override
protected void configureConstructorTemplate() {
  Method constructor = new Method();
  constructor.setConstructor(true);
  constructor.setVisibility(JavaVisibility.PUBLIC);
  constructor
      .addParameter(new Parameter(sqlMapClientType, "sqlMapClient")); //$NON-NLS-1$
  constructor.addBodyLine("super();"); //$NON-NLS-1$
  constructor.addBodyLine("this.sqlMapClient = sqlMapClient;"); //$NON-NLS-1$
  setConstructorTemplate(constructor);
}

代码示例来源: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: org.mybatis.generator/mybatis-generator-core

@Override
protected void configureConstructorTemplate() {
  Method method = new Method();
  method.setConstructor(true);
  method.setVisibility(JavaVisibility.PUBLIC);
  method.addBodyLine("super();"); //$NON-NLS-1$
  setConstructorTemplate(method);
}

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

@Override
protected void configureConstructorTemplate() {
  Method method = new Method();
  method.setConstructor(true);
  method.setVisibility(JavaVisibility.PUBLIC);
  method.addBodyLine("super();"); //$NON-NLS-1$
  setConstructorTemplate(method);
}

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

@Override
protected void configureConstructorTemplate() {
  Method method = new Method();
  method.setConstructor(true);
  method.setVisibility(JavaVisibility.PUBLIC);
  method.addBodyLine("super();"); //$NON-NLS-1$
  setConstructorTemplate(method);
}

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

@Override
protected void configureConstructorTemplate() {
  Method method = new Method();
  method.setConstructor(true);
  method.setVisibility(JavaVisibility.PUBLIC);
  method.addParameter(new Parameter(fqjt, "daoManager")); //$NON-NLS-1$
  method.addBodyLine("super(daoManager);"); //$NON-NLS-1$
  setConstructorTemplate(method);
}

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

@Override
protected void configureConstructorTemplate() {
  Method method = new Method();
  method.setConstructor(true);
  method.setVisibility(JavaVisibility.PUBLIC);
  method.addParameter(new Parameter(fqjt, "daoManager")); //$NON-NLS-1$
  method.addBodyLine("super(daoManager);"); //$NON-NLS-1$
  setConstructorTemplate(method);
}

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

protected Method getDefaultConstructor(TopLevelClass topLevelClass) {
    Method method = new Method();
    method.setVisibility(JavaVisibility.PUBLIC);
    method.setConstructor(true);
    method.setName(topLevelClass.getType().getShortName());
    method.addBodyLine("super();"); //$NON-NLS-1$
    context.getCommentGenerator().addGeneralMethodComment(method, introspectedTable);
    return method;
  }
}

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

protected void addDefaultConstructor(TopLevelClass topLevelClass) {
    Method method = new Method();
    method.setVisibility(JavaVisibility.PUBLIC);
    method.setConstructor(true);
    method.setName(topLevelClass.getType().getShortName());
    method.addBodyLine("super();"); //$NON-NLS-1$
    context.getCommentGenerator().addGeneralMethodComment(method, introspectedTable);
    topLevelClass.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);
}

相关文章