Skip to content

Commit 690770d

Browse files
authored
Merge pull request #1867 from hazendaz/copyright
[cleanup] Simplify code based on PR #1652
2 parents 75e748e + fd585f1 commit 690770d

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

src/main/java/org/apache/ibatis/builder/annotation/MapperAnnotationBuilder.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -486,12 +486,7 @@ private SqlSource getSqlSourceFromAnnotations(Method method, Class<?> parameterT
486486
}
487487

488488
private SqlSource buildSqlSourceFromStrings(String[] strings, Class<?> parameterTypeClass, LanguageDriver languageDriver) {
489-
final StringBuilder sql = new StringBuilder();
490-
for (String fragment : strings) {
491-
sql.append(fragment);
492-
sql.append(" ");
493-
}
494-
return languageDriver.createSqlSource(configuration, sql.toString().trim(), parameterTypeClass);
489+
return languageDriver.createSqlSource(configuration, String.join(" ", strings).trim(), parameterTypeClass);
495490
}
496491

497492
private SqlCommandType getSqlCommandType(Method method) {

src/main/java/org/apache/ibatis/builder/xml/XMLMapperBuilder.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import java.io.InputStream;
1919
import java.io.Reader;
2020
import java.util.ArrayList;
21+
import java.util.Arrays;
2122
import java.util.Collection;
2223
import java.util.Collections;
2324
import java.util.HashMap;
@@ -393,8 +394,8 @@ private ResultMapping buildResultMappingFromContext(XNode context, Class<?> resu
393394
}
394395

395396
private String processNestedResultMappings(XNode context, List<ResultMapping> resultMappings, Class<?> enclosingType) {
396-
if (("association".equals(context.getName()) || "collection".equals(context.getName())
397-
|| "case".equals(context.getName())) && context.getStringAttribute("select") == null) {
397+
if (Arrays.asList("association", "collection", "case").contains(context.getName())
398+
&& context.getStringAttribute("select") == null) {
398399
validateCollection(context, enclosingType);
399400
ResultMap resultMap = resultMapElement(context, resultMappings, enclosingType);
400401
return resultMap.getId();

0 commit comments

Comments
 (0)