本文整理了Java中org.mybatis.generator.api.dom.java.Method.getBodyLines()
方法的一些代码示例,展示了Method.getBodyLines()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Method.getBodyLines()
方法的具体详情如下:
包路径:org.mybatis.generator.api.dom.java.Method
类名称:Method
方法名:getBodyLines
暂无
代码示例来源:origin: org.mybatis.generator/mybatis-generator-core
private void copyAndAddSelectByExampleMethodForDSQL(Method method, Interface interfaze) {
Method newMethod = new Method(method);
newMethod.addParameter(new Parameter(rowBounds, "rowBounds")); //$NON-NLS-1$
interfaze.addMethod(newMethod);
interfaze.addImportedType(rowBounds);
// replace the call to selectMany with the new call to selectManyWithRowbounds
for (int i = 0; i < newMethod.getBodyLines().size(); i++) {
String bodyLine = newMethod.getBodyLines().get(i);
if (bodyLine.contains("this::selectMany")) { //$NON-NLS-1$
bodyLine = bodyLine.replace("this::selectMany", //$NON-NLS-1$
"selectManyWithRowbounds(rowBounds)"); //$NON-NLS-1$
newMethod.getBodyLines().set(i, bodyLine);
break;
}
}
}
代码示例来源: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: dcendents/mybatis-generator-plugins
@Override
public boolean modelSetterMethodGenerated(Method method, TopLevelClass topLevelClass,
IntrospectedColumn introspectedColumn, IntrospectedTable introspectedTable, ModelClassType modelClassType) {
if (tableMatches(introspectedTable) && settersToWrap.contains(method.getName())) {
method.getBodyLines().clear();
method.addBodyLine(String.format("this.%s.%s(%s);", objectFieldName, method.getName(), method
.getParameters().get(0).getName()));
}
return true;
}
代码示例来源:origin: oceanc/mybatis3-generator-plugins
@Override
public boolean modelBaseRecordClassGenerated(TopLevelClass topLevelClass, IntrospectedTable introspectedTable) {
topLevelClass.addAnnotation("@Data");
topLevelClass.addImportedType(new FullyQualifiedJavaType("lombok.Data"));
List<Method> methods = topLevelClass.getMethods();
List<Method> remove = new ArrayList<Method>();
for (Method method : methods) {
if (method.getBodyLines().size() < 2) {
remove.add(method);
System.out.println("-----------------" + topLevelClass.getType().getShortName() + "'s method=" + method.getName() + " removed cause lombok annotation.");
}
}
methods.removeAll(remove);
return true;
}
代码示例来源:origin: io.github.cgi/mybatis-generator-plugins
/**
* {@inheritDoc}
*/
@Override
public boolean modelExampleClassGenerated(TopLevelClass topLevelClass,
IntrospectedTable introspectedTable) {
List<InnerClass> innerClasses = topLevelClass.getInnerClasses();
for (InnerClass innerClass : innerClasses) {
if ("Criteria".equals(innerClass.getType().getShortName())) {
addFactoryMethodToCriteria(topLevelClass, innerClass, introspectedTable);
}
}
List<Method> methods = topLevelClass.getMethods();
for (Method method : methods) {
if (!"createCriteriaInternal".equals(method.getName()))
continue;
method.getBodyLines().set(0, "Criteria criteria = new Criteria(this);");
}
return true;
}
代码示例来源: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;
}
代码示例来源: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 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;
}
内容来源于网络,如有侵权,请联系作者删除!