zkongbai opened a new issue, #21985:
URL: https://github.com/apache/shardingsphere/issues/21985
org.apache.shardingsphere.infra.datasource.pool.creator.DataSourceReflection#findSetterMethod(java.lang.String)
the code like this:
private Optional<Method> findSetterMethod(final String fieldName) {
String setterMethodName = SETTER_PREFIX +
CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_CAMEL, fieldName);
return Arrays.stream(dataSourceMethods).filter(each ->
each.getName().equals(setterMethodName) && 1 ==
each.getParameterTypes().length).findFirst();
}
when i use durid at 1.2.9, the code preview will product a bug. because the
method is not the only one.
so it can be change like this?
private Optional<Method> findSetterMethod(final String fieldName, final
Object fieldValue) {
String setterMethodName = SETTER_PREFIX +
CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_CAMEL, fieldName);
Stream<Method> methodStream =
Arrays.stream(dataSourceMethods).filter(each ->
each.getName().equals(setterMethodName) && 1 ==
each.getParameterTypes().length);
//TODO: By -> 改造set方法有多个的时候,会报错问题.比如: setDBType (at druid 1.2.9)
return
methodStream.filter(m->m.getParameterTypes()[0].equals(fieldValue.getClass())).findFirst();
}
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail:
[email protected]
For queries about this service, please contact Infrastructure at:
[email protected]