Skip to content

Commit 1261a34

Browse files
committed
Drop declaringClass arg for now
1 parent a22361d commit 1261a34

File tree

7 files changed

+12
-22
lines changed

7 files changed

+12
-22
lines changed

src/main/java/org/apache/ibatis/builder/BaseBuilder.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ protected TypeHandler<?> resolveTypeHandler(Class<?> javaType, String typeHandle
112112

113113
@Deprecated
114114
protected TypeHandler<?> resolveTypeHandler(Class<?> javaType, Class<? extends TypeHandler<?>> typeHandlerType) {
115-
return resolveTypeHandler(null, javaType, null, typeHandlerType);
115+
return resolveTypeHandler(javaType, null, typeHandlerType);
116116
}
117117

118118
protected TypeHandler<?> resolveTypeHandler(Class<?> parameterType, Type propertyType, JdbcType jdbcType,
@@ -123,15 +123,15 @@ protected TypeHandler<?> resolveTypeHandler(Class<?> parameterType, Type propert
123123
throw new BuilderException("Type " + typeHandlerType.getName()
124124
+ " is not a valid TypeHandler because it does not implement TypeHandler interface");
125125
}
126-
return resolveTypeHandler(parameterType, propertyType, jdbcType, typeHandlerType);
126+
return resolveTypeHandler(propertyType, jdbcType, typeHandlerType);
127127
}
128128

129-
protected TypeHandler<?> resolveTypeHandler(Class<?> parameterType, Type propertyType, JdbcType jdbcType,
129+
protected TypeHandler<?> resolveTypeHandler(Type javaType, JdbcType jdbcType,
130130
Class<? extends TypeHandler<?>> typeHandlerType) {
131131
if (typeHandlerType == null && jdbcType == null) {
132132
return null;
133133
}
134-
return configuration.getTypeHandlerRegistry().resolve(parameterType, propertyType, jdbcType, typeHandlerType);
134+
return configuration.getTypeHandlerRegistry().getTypeHandler(javaType, jdbcType, typeHandlerType);
135135
}
136136

137137
protected <T> Class<? extends T> resolveAlias(String alias) {

src/main/java/org/apache/ibatis/builder/MapperBuilderAssistant.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ public ParameterMapping buildParameterMapping(Class<?> parameterType, String pro
149149

150150
// Class parameterType = parameterMapBuilder.type();
151151
Class<?> javaTypeClass = resolveParameterJavaType(parameterType, property, javaType, jdbcType);
152-
TypeHandler<?> typeHandlerInstance = resolveTypeHandler(parameterType, javaTypeClass, jdbcType, typeHandler);
152+
TypeHandler<?> typeHandlerInstance = resolveTypeHandler(javaTypeClass, jdbcType, typeHandler);
153153

154154
return new ParameterMapping.Builder(configuration, property, javaTypeClass).jdbcType(jdbcType)
155155
.resultMapId(resultMap).mode(parameterMode).numericScale(numericScale).typeHandler(typeHandlerInstance).build();
@@ -342,7 +342,7 @@ public ResultMapping buildResultMapping(Class<?> resultType, String property, St
342342
Class<? extends TypeHandler<?>> typeHandler, List<ResultFlag> flags, String resultSet, String foreignColumn,
343343
boolean lazy) {
344344
Entry<Type, Class<?>> setterType = resolveSetterType(resultType, property, javaType);
345-
TypeHandler<?> typeHandlerInstance = resolveTypeHandler(resultType, setterType.getKey(), jdbcType, typeHandler);
345+
TypeHandler<?> typeHandlerInstance = resolveTypeHandler(setterType.getKey(), jdbcType, typeHandler);
346346
List<ResultMapping> composites;
347347
if ((nestedSelect == null || nestedSelect.isEmpty()) && (foreignColumn == null || foreignColumn.isEmpty())) {
348348
composites = Collections.emptyList();

src/main/java/org/apache/ibatis/builder/ParameterMappingTokenHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ private Class<?> figureOutJavaType(Map<String, String> propertiesMap, String pro
144144
if (metaParameters.hasGetter(propertyTokenizer.getName())) { // issue #448 get type from additional params
145145
return metaParameters.getGetterType(property);
146146
}
147-
typeHandler = resolveTypeHandler(parameterType, null, jdbcType, (Class<? extends TypeHandler<?>>) null);
147+
typeHandler = resolveTypeHandler(parameterType, jdbcType, (Class<? extends TypeHandler<?>>) null);
148148
if (typeHandler != null) {
149149
return parameterType;
150150
}

src/main/java/org/apache/ibatis/executor/resultset/DefaultResultSetHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ public void handleOutputParameters(CallableStatement cs) throws SQLException {
168168
javaType = metaParam.getGenericSetterType(property).getKey();
169169
}
170170
JdbcType jdbcType = parameterMapping.getJdbcType();
171-
typeHandler = typeHandlerRegistry.resolve(parameterObject.getClass(), javaType, jdbcType, null);
171+
typeHandler = typeHandlerRegistry.getTypeHandler(javaType, jdbcType, null);
172172
if (typeHandler == null) {
173173
typeHandler = typeHandlerRegistry.getTypeHandler(jdbcType);
174174
if (typeHandler == null) {

src/main/java/org/apache/ibatis/executor/resultset/ResultSetWrapper.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public TypeHandler<?> getTypeHandler(Type propertyType, String columnName) {
102102
}
103103

104104
JdbcType jdbcType = jdbcTypes.get(index);
105-
TypeHandler<?> handler = typeHandlerRegistry.resolve(null, k, jdbcType, null);
105+
TypeHandler<?> handler = typeHandlerRegistry.getTypeHandler(k, jdbcType, null);
106106
if (handler != null) {
107107
return handler;
108108
}
@@ -113,7 +113,7 @@ public TypeHandler<?> getTypeHandler(Type propertyType, String columnName) {
113113
return null;
114114
}
115115

116-
handler = typeHandlerRegistry.resolve(null, javaType, jdbcType, null);
116+
handler = typeHandlerRegistry.getTypeHandler(javaType, jdbcType, null);
117117
if (handler == null) {
118118
handler = typeHandlerRegistry.getTypeHandler(jdbcType);
119119
}

src/main/java/org/apache/ibatis/scripting/defaults/DefaultParameterHandler.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,6 @@ public void setParameters(PreparedStatement ps) {
106106
value = parameterMapping.getValue();
107107
} else if (boundSql.hasAdditionalParameter(propertyName)) { // issue #448 ask first for additional params
108108
value = boundSql.getAdditionalParameter(propertyName);
109-
if (typeHandler == null) {
110-
typeHandler = typeHandlerRegistry.resolve(value.getClass(), null, actualJdbcType, null);
111-
}
112109
} else if (parameterObject == null) {
113110
value = null;
114111
} else {
@@ -144,7 +141,7 @@ public void setParameters(PreparedStatement ps) {
144141
} else {
145142
try {
146143
propertyGenericType = paramMetaObject.getGenericGetterType(propertyName).getKey();
147-
typeHandler = configuration.getTypeHandlerRegistry().resolve(parameterClass, propertyGenericType,
144+
typeHandler = configuration.getTypeHandlerRegistry().getTypeHandler(propertyGenericType,
148145
actualJdbcType, null);
149146
} catch (Exception e) {
150147
// Not always resolvable
@@ -164,8 +161,7 @@ public void setParameters(PreparedStatement ps) {
164161
if (propertyGenericType == null) {
165162
propertyGenericType = value.getClass();
166163
}
167-
typeHandler = typeHandlerRegistry.resolve(parameterObject.getClass(), propertyGenericType, actualJdbcType,
168-
null);
164+
typeHandler = typeHandlerRegistry.getTypeHandler(propertyGenericType, actualJdbcType, null);
169165
}
170166
if (typeHandler == null) {
171167
typeHandler = typeHandlerRegistry.getTypeHandler(actualJdbcType);

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

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -566,10 +566,4 @@ public Collection<TypeHandler<?>> getTypeHandlers() {
566566
return Collections.unmodifiableCollection(allTypeHandlersMap.values());
567567
}
568568

569-
public TypeHandler<?> resolve(Class<?> declaringClass, Type propertyType, JdbcType jdbcType,
570-
Class<? extends TypeHandler<?>> typeHandlerClass) {
571-
Type javaType = propertyType == null ? declaringClass : propertyType;
572-
return getTypeHandler(javaType, jdbcType, typeHandlerClass);
573-
}
574-
575569
}

0 commit comments

Comments
 (0)