Skip to content

Commit edeebcf

Browse files
committed
Coverage
1 parent 139855d commit edeebcf

File tree

1 file changed

+0
-80
lines changed

1 file changed

+0
-80
lines changed

core/mybatis-generator-core/src/main/java/org/mybatis/generator/plugins/RowBoundsPlugin.java

Lines changed: 0 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import java.util.Iterator;
2121
import java.util.List;
2222
import java.util.Map;
23-
import java.util.Optional;
2423

2524
import org.mybatis.generator.api.FullyQualifiedTable;
2625
import org.mybatis.generator.api.IntrospectedTable;
@@ -111,40 +110,6 @@ public boolean sqlMapDocumentGenerated(Document document,
111110
return true;
112111
}
113112

114-
@Override
115-
public boolean clientBasicSelectManyMethodGenerated(Method method, Interface interfaze,
116-
IntrospectedTable introspectedTable) {
117-
copyAndAddSelectManyMethod(method, interfaze);
118-
119-
addNewComposedFunction(interfaze, introspectedTable, method);
120-
return true;
121-
}
122-
123-
private void addNewComposedFunction(Interface interfaze, IntrospectedTable introspectedTable,
124-
Method baseMethod) {
125-
Optional<FullyQualifiedJavaType> methodReturnType = baseMethod.getReturnType();
126-
if (!methodReturnType.isPresent()) {
127-
// shouldn't happen, but just in case...
128-
return;
129-
}
130-
131-
interfaze.addImportedType(new FullyQualifiedJavaType("java.util.function.Function")); //$NON-NLS-1$
132-
133-
FullyQualifiedJavaType returnType =
134-
new FullyQualifiedJavaType("Function<SelectStatementProvider, " //$NON-NLS-1$
135-
+ methodReturnType.get().getShortName() + ">"); //$NON-NLS-1$
136-
137-
Method method = new Method("selectManyWithRowbounds"); //$NON-NLS-1$
138-
method.setDefault(true);
139-
method.setReturnType(returnType);
140-
method.addParameter(new Parameter(rowBounds, "rowBounds")); //$NON-NLS-1$
141-
method.addBodyLine(
142-
"return selectStatement -> selectManyWithRowbounds(selectStatement, rowBounds);"); //$NON-NLS-1$
143-
context.getCommentGenerator().addGeneralMethodAnnotation(
144-
method, introspectedTable, interfaze.getImportedTypes());
145-
interfaze.addMethod(method);
146-
}
147-
148113
/**
149114
* Use the method copy constructor to create a new method, then
150115
* add the rowBounds parameter.
@@ -160,51 +125,6 @@ private void copyAndAddMethod(Method method, Interface interfaze) {
160125
interfaze.addImportedType(rowBounds);
161126
}
162127

163-
private void copyAndAddSelectManyMethod(Method method, Interface interfaze) {
164-
List<String> annotations = new ArrayList<>(method.getAnnotations());
165-
166-
// remove the @Results annotation and replace it with @ResultMap
167-
boolean inResultsAnnotation = false;
168-
String resultMapId = null;
169-
Iterator<String> iter = annotations.iterator();
170-
while (iter.hasNext()) {
171-
String annotation = iter.next();
172-
173-
if (inResultsAnnotation) {
174-
if (annotation.equals("})")) { //$NON-NLS-1$
175-
inResultsAnnotation = false;
176-
}
177-
iter.remove();
178-
} else if (annotation.startsWith("@Results(")) { //$NON-NLS-1$
179-
inResultsAnnotation = true;
180-
iter.remove();
181-
182-
// now find the ID
183-
int index = annotation.indexOf("id=\""); //$NON-NLS-1$
184-
int startIndex = index + "id=\"".length(); //$NON-NLS-1$
185-
int endIndex = annotation.indexOf('\"', startIndex + 1); //$NON-NLS-1$
186-
resultMapId = annotation.substring(startIndex, endIndex);
187-
}
188-
}
189-
190-
if (resultMapId != null) {
191-
interfaze.addImportedType(
192-
new FullyQualifiedJavaType("org.apache.ibatis.annotations.ResultMap")); //$NON-NLS-1$
193-
annotations.add("@ResultMap(\"" + resultMapId + "\")"); //$NON-NLS-1$ //$NON-NLS-2$
194-
}
195-
196-
Method newMethod = new Method(method);
197-
newMethod.getAnnotations().clear();
198-
for (String annotation : annotations) {
199-
newMethod.addAnnotation(annotation);
200-
}
201-
202-
newMethod.setName(method.getName() + "WithRowbounds"); //$NON-NLS-1$
203-
newMethod.addParameter(new Parameter(rowBounds, "rowBounds")); //$NON-NLS-1$
204-
interfaze.addMethod(newMethod);
205-
interfaze.addImportedType(rowBounds);
206-
}
207-
208128
/**
209129
* Use the method copy constructor to create a new element.
210130
*

0 commit comments

Comments
 (0)