This commit is contained in:
Looly 2023-01-09 18:01:48 +08:00
parent c7ffae7915
commit b9417a4114
3 changed files with 9 additions and 9 deletions

View File

@ -377,7 +377,7 @@ public class Convert {
* @param defaultValue 转换错误时的默认值
* @return 结果
*/
public static Boolean toBool(final Object value, final Boolean defaultValue) {
public static Boolean toBoolean(final Object value, final Boolean defaultValue) {
return convertQuietly(Boolean.class, value, defaultValue);
}
@ -389,8 +389,8 @@ public class Convert {
* @param value 被转换的值
* @return 结果
*/
public static Boolean toBool(final Object value) {
return toBool(value, null);
public static Boolean toBoolean(final Object value) {
return toBoolean(value, null);
}
/**

View File

@ -8,17 +8,17 @@ public class ConvertToBooleanTest {
@Test
public void intToBooleanTest() {
final int a = 100;
final Boolean aBoolean = Convert.toBool(a);
final Boolean aBoolean = Convert.toBoolean(a);
Assert.assertTrue(aBoolean);
final int b = 0;
final Boolean bBoolean = Convert.toBool(b);
final Boolean bBoolean = Convert.toBoolean(b);
Assert.assertFalse(bBoolean);
}
@Test
public void issueI65P8ATest() {
final Boolean bool = Convert.toBool("", Boolean.TRUE);
final Boolean bool = Convert.toBoolean("", Boolean.TRUE);
Assert.assertFalse(bool);
}

View File

@ -108,9 +108,9 @@ public final class DbUtil {
*/
public static void setShowSqlGlobal(final Setting setting) {
// 初始化SQL显示
final boolean isShowSql = Convert.toBool(setting.remove(SqlLog.KEY_SHOW_SQL), false);
final boolean isFormatSql = Convert.toBool(setting.remove(SqlLog.KEY_FORMAT_SQL), false);
final boolean isShowParams = Convert.toBool(setting.remove(SqlLog.KEY_SHOW_PARAMS), false);
final boolean isShowSql = Convert.toBoolean(setting.remove(SqlLog.KEY_SHOW_SQL), false);
final boolean isFormatSql = Convert.toBoolean(setting.remove(SqlLog.KEY_FORMAT_SQL), false);
final boolean isShowParams = Convert.toBoolean(setting.remove(SqlLog.KEY_SHOW_PARAMS), false);
String sqlLevelStr = setting.remove(SqlLog.KEY_SQL_LEVEL);
if (null != sqlLevelStr) {
sqlLevelStr = sqlLevelStr.toUpperCase();