Skip to content

Commit 971bc24

Browse files
committed
Minor refactoring.
1 parent 3ccb8ec commit 971bc24

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/main/java/org/apache/ibatis/type/TypeHandlerRegistry.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -205,16 +205,16 @@ private <T> TypeHandler<T> getTypeHandler(Type type, JdbcType jdbcType) {
205205
}
206206

207207
private TypeHandler<?> pickSoleHandler(Map<JdbcType, TypeHandler<?>> jdbcHandlerMap) {
208-
boolean onlyChoice = true;
209208
TypeHandler<?> soleHandler = null;
210209
for (TypeHandler<?> handler : jdbcHandlerMap.values()) {
211-
if (soleHandler != null && !handler.getClass().equals(soleHandler.getClass())) {
212-
onlyChoice = false;
213-
break;
210+
if (soleHandler == null) {
211+
soleHandler = handler;
212+
} else if (!handler.getClass().equals(soleHandler.getClass())) {
213+
// More than one type handlers registered.
214+
return null;
214215
}
215-
soleHandler = handler;
216216
}
217-
return onlyChoice ? soleHandler : null;
217+
return soleHandler;
218218
}
219219

220220
public TypeHandler<Object> getUnknownTypeHandler() {

0 commit comments

Comments
 (0)