Skip to content

Commit 9cce295

Browse files
committed
optimize mapper builder
1 parent 2967694 commit 9cce295

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,9 @@ private void cacheRefElement(XNode context) {
161161
private void cacheElement(XNode context) {
162162
if (context != null) {
163163
String type = context.getStringAttribute("type", "PERPETUAL");
164-
Class<? extends Cache> typeClass = typeAliasRegistry.resolveAlias(type);
164+
Class<? extends Cache> typeClass = resolveAlias(type);
165165
String eviction = context.getStringAttribute("eviction", "LRU");
166-
Class<? extends Cache> evictionClass = typeAliasRegistry.resolveAlias(eviction);
166+
Class<? extends Cache> evictionClass = resolveAlias(eviction);
167167
Long flushInterval = context.getLongAttribute("flushInterval");
168168
Integer size = context.getIntAttribute("size");
169169
boolean readWrite = !context.getBooleanAttribute("readOnly", false);
@@ -239,7 +239,7 @@ private ResultMap resultMapElement(XNode resultMapNode, List<ResultMapping> addi
239239
resultMappings.add(buildResultMappingFromContext(resultChild, typeClass, flags));
240240
}
241241
}
242-
String id = resultMapNode.getStringAttribute("id", resultMapNode.getValueBasedIdentifier());
242+
String id = resultMapNode.getStringAttribute("id", resultMapNode::getValueBasedIdentifier);
243243
String extend = resultMapNode.getStringAttribute("extends");
244244
Boolean autoMapping = resultMapNode.getBooleanAttribute("autoMapping");
245245
ResultMapResolver resultMapResolver = new ResultMapResolver(builderAssistant, id, typeClass, extend, discriminator,
@@ -289,8 +289,7 @@ private Discriminator processDiscriminatorElement(XNode context, Class<?> result
289289
Map<String, String> discriminatorMap = new HashMap<>();
290290
for (XNode caseChild : context.getChildren()) {
291291
String value = caseChild.getStringAttribute("value");
292-
String resultMap = caseChild.getStringAttribute("resultMap",
293-
processNestedResultMappings(caseChild, resultMappings, resultType));
292+
String resultMap = caseChild.getStringAttribute("resultMap", () -> processNestedResultMappings(caseChild, resultMappings, resultType));
294293
discriminatorMap.put(value, resultMap);
295294
}
296295
return builderAssistant.buildDiscriminator(resultType, column, javaTypeClass, jdbcTypeEnum, typeHandlerClass,

0 commit comments

Comments
 (0)