Convert change to ConvertUtil

This commit is contained in:
Looly
2024-08-23 08:36:52 +08:00
parent c6777244a0
commit 3ddad8ff6c
92 changed files with 336 additions and 339 deletions

View File

@@ -16,7 +16,7 @@
package org.dromara.hutool.db.config;
import org.dromara.hutool.core.convert.Convert;
import org.dromara.hutool.core.convert.ConvertUtil;
import org.dromara.hutool.core.io.resource.NoResourceException;
import org.dromara.hutool.core.map.MapUtil;
import org.dromara.hutool.core.text.StrUtil;
@@ -148,7 +148,7 @@ public class SettingConfigParser implements ConfigParser {
// 大小写等配置
final String caseInsensitive = setting.getAndRemove(DSKeys.KEY_CASE_INSENSITIVE);
if (StrUtil.isNotBlank(caseInsensitive)) {
dbConfig.setCaseInsensitive(Convert.toBoolean(caseInsensitive));
dbConfig.setCaseInsensitive(ConvertUtil.toBoolean(caseInsensitive));
}
// remarks等连接配置since 5.3.8
@@ -183,18 +183,18 @@ public class SettingConfigParser implements ConfigParser {
*/
private static SqlLogFilter getSqlLogFilter(final Setting setting) {
// 初始化SQL显示
final boolean isShowSql = Convert.toBoolean(setting.remove(DSKeys.KEY_SHOW_SQL), false);
final boolean isShowSql = ConvertUtil.toBoolean(setting.remove(DSKeys.KEY_SHOW_SQL), false);
if (!isShowSql) {
return null;
}
final boolean isFormatSql = Convert.toBoolean(setting.remove(DSKeys.KEY_FORMAT_SQL), false);
final boolean isShowParams = Convert.toBoolean(setting.remove(DSKeys.KEY_SHOW_PARAMS), false);
final boolean isFormatSql = ConvertUtil.toBoolean(setting.remove(DSKeys.KEY_FORMAT_SQL), false);
final boolean isShowParams = ConvertUtil.toBoolean(setting.remove(DSKeys.KEY_SHOW_PARAMS), false);
String sqlLevelStr = setting.remove(DSKeys.KEY_SQL_LEVEL);
if (null != sqlLevelStr) {
sqlLevelStr = sqlLevelStr.toUpperCase();
}
final Level level = Convert.toEnum(Level.class, sqlLevelStr, Level.DEBUG);
final Level level = ConvertUtil.toEnum(Level.class, sqlLevelStr, Level.DEBUG);
final SqlLog sqlLog = new SqlLog();
sqlLog.init(isShowSql, isFormatSql, isShowParams, level);

View File

@@ -16,7 +16,7 @@
package org.dromara.hutool.db.handler;
import org.dromara.hutool.core.convert.Convert;
import org.dromara.hutool.core.convert.ConvertUtil;
import org.dromara.hutool.core.lang.Assert;
import org.dromara.hutool.core.text.StrUtil;
import org.dromara.hutool.db.DbException;
@@ -59,7 +59,7 @@ public class ResultSetUtil {
} else if (Iterable.class.isAssignableFrom(beanClass)) {
//集合
final Object[] objRow = toBean(meta, rs, Object[].class);
return Convert.convert(beanClass, objRow);
return ConvertUtil.convert(beanClass, objRow);
} else if (beanClass.isAssignableFrom(Entity.class)) {
//Entity的父类都可按照Entity返回
return (T) new EntityRowHandler(meta, false, true).handle(rs);
@@ -191,7 +191,7 @@ public class ResultSetUtil {
return rawValue;
} else {
// 按照返回值要求转换
return Convert.convert(targetColumnType, rawValue);
return ConvertUtil.convert(targetColumnType, rawValue);
}
}
}

View File

@@ -17,7 +17,7 @@
package org.dromara.hutool.db.meta;
import org.dromara.hutool.core.collection.CollUtil;
import org.dromara.hutool.core.convert.Convert;
import org.dromara.hutool.core.convert.ConvertUtil;
import org.dromara.hutool.core.lang.wrapper.SimpleWrapper;
import org.dromara.hutool.core.text.StrUtil;
import org.dromara.hutool.core.util.ObjUtil;
@@ -123,7 +123,7 @@ public class DatabaseMetaDataWrapper extends SimpleWrapper<DatabaseMetaData> {
*/
public List<String> getTableNames(final String tableNamePattern, final TableType... types) {
List<String> result = null;
try (final ResultSet rs = this.raw.getTables(catalog, schema, tableNamePattern, Convert.toStrArray(types))) {
try (final ResultSet rs = this.raw.getTables(catalog, schema, tableNamePattern, ConvertUtil.toStrArray(types))) {
if (null != rs) {
// 初始化结果列表大小为ResultSet的获取大小。
result = new ArrayList<>(rs.getFetchSize());

View File

@@ -17,7 +17,7 @@
package org.dromara.hutool.db.sql;
import org.dromara.hutool.core.array.ArrayUtil;
import org.dromara.hutool.core.convert.Convert;
import org.dromara.hutool.core.convert.ConvertUtil;
import org.dromara.hutool.core.exception.CloneException;
import org.dromara.hutool.core.math.NumberUtil;
import org.dromara.hutool.core.text.CharUtil;
@@ -456,7 +456,7 @@ public class Condition implements Cloneable, Serializable {
} else if (value instanceof CharSequence) {
valuesForIn = SplitUtil.split((CharSequence) value, StrUtil.COMMA);
} else {
valuesForIn = Arrays.asList(Convert.convert(Object[].class, value));
valuesForIn = Arrays.asList(ConvertUtil.convert(Object[].class, value));
}
conditionStrBuilder.append(StrUtil.repeatAndJoin("?", valuesForIn.size(), StrUtil.COMMA));
if (null != paramValues) {

View File

@@ -19,7 +19,7 @@ package org.dromara.hutool.db.sql;
import org.dromara.hutool.core.array.ArrayUtil;
import org.dromara.hutool.core.collection.ListUtil;
import org.dromara.hutool.core.collection.iter.ArrayIter;
import org.dromara.hutool.core.convert.Convert;
import org.dromara.hutool.core.convert.ConvertUtil;
import org.dromara.hutool.core.lang.Assert;
import org.dromara.hutool.core.lang.builder.Builder;
import org.dromara.hutool.core.map.MapUtil;
@@ -219,7 +219,7 @@ public class StatementBuilder implements Builder<StatementWrapper> {
if (ArrayUtil.isNotEmpty(params) && 1 == params.length && params[0] instanceof Map) {
// 检查参数是否为命名方式的参数
final NamedSql namedSql = new NamedSql(sql, Convert.toMap(String.class, Object.class, params[0]));
final NamedSql namedSql = new NamedSql(sql, ConvertUtil.toMap(String.class, Object.class, params[0]));
sql = namedSql.getSql();
params = namedSql.getParamArray();
}