mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-04-19 03:01:48 +08:00
fix code
This commit is contained in:
parent
e05e9f13b5
commit
b696ad4b08
@ -812,12 +812,12 @@ public class BeanUtil {
|
||||
* 判断Bean是否为非空对象,非空对象表示本身不为{@code null}或者含有非{@code null}属性的对象
|
||||
*
|
||||
* @param bean Bean对象
|
||||
* @param ignoreFiledNames 忽略检查的字段名
|
||||
* @param ignoreFieldNames 忽略检查的字段名
|
||||
* @return 是否为非空,{@code true} - 非空 / {@code false} - 空
|
||||
* @since 5.0.7
|
||||
*/
|
||||
public static boolean isNotEmpty(final Object bean, final String... ignoreFiledNames) {
|
||||
return false == isEmpty(bean, ignoreFiledNames);
|
||||
public static boolean isNotEmpty(final Object bean, final String... ignoreFieldNames) {
|
||||
return false == isEmpty(bean, ignoreFieldNames);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -825,17 +825,17 @@ public class BeanUtil {
|
||||
* 此方法不判断static属性
|
||||
*
|
||||
* @param bean Bean对象
|
||||
* @param ignoreFiledNames 忽略检查的字段名
|
||||
* @param ignoreFieldNames 忽略检查的字段名
|
||||
* @return 是否为空,{@code true} - 空 / {@code false} - 非空
|
||||
* @since 4.1.10
|
||||
*/
|
||||
public static boolean isEmpty(final Object bean, final String... ignoreFiledNames) {
|
||||
public static boolean isEmpty(final Object bean, final String... ignoreFieldNames) {
|
||||
if (null != bean) {
|
||||
for (final Field field : FieldUtil.getFields(bean.getClass())) {
|
||||
if (ModifierUtil.isStatic(field)) {
|
||||
continue;
|
||||
}
|
||||
if ((false == ArrayUtil.contains(ignoreFiledNames, field.getName()))
|
||||
if ((false == ArrayUtil.contains(ignoreFieldNames, field.getName()))
|
||||
&& null != FieldUtil.getFieldValue(bean, field)) {
|
||||
return false;
|
||||
}
|
||||
@ -849,11 +849,11 @@ public class BeanUtil {
|
||||
* 对象本身为{@code null}也返回true
|
||||
*
|
||||
* @param bean Bean对象
|
||||
* @param ignoreFiledNames 忽略检查的字段名
|
||||
* @param ignoreFieldNames 忽略检查的字段名
|
||||
* @return 是否包含值为<code>null</code>的属性,{@code true} - 包含 / {@code false} - 不包含
|
||||
* @since 4.1.10
|
||||
*/
|
||||
public static boolean hasNullField(final Object bean, final String... ignoreFiledNames) {
|
||||
public static boolean hasNullField(final Object bean, final String... ignoreFieldNames) {
|
||||
if (null == bean) {
|
||||
return true;
|
||||
}
|
||||
@ -861,7 +861,7 @@ public class BeanUtil {
|
||||
if (ModifierUtil.isStatic(field)) {
|
||||
continue;
|
||||
}
|
||||
if ((false == ArrayUtil.contains(ignoreFiledNames, field.getName()))
|
||||
if ((false == ArrayUtil.contains(ignoreFieldNames, field.getName()))
|
||||
&& null == FieldUtil.getFieldValue(bean, field)) {
|
||||
return true;
|
||||
}
|
||||
|
@ -22,9 +22,8 @@ import java.util.Map;
|
||||
* 方言工厂类
|
||||
*
|
||||
* @author loolly
|
||||
*
|
||||
*/
|
||||
public class DialectFactory implements DriverNamePool{
|
||||
public class DialectFactory implements DriverNamePool {
|
||||
|
||||
private static final Map<DataSource, Dialect> DIALECT_POOL = new SafeConcurrentHashMap<>();
|
||||
|
||||
@ -79,7 +78,18 @@ public class DialectFactory implements DriverNamePool{
|
||||
* @param nameContainsProductInfo 包含数据库标识的字符串
|
||||
* @return 驱动
|
||||
*/
|
||||
public static String identifyDriver(String nameContainsProductInfo) {
|
||||
public static String identifyDriver(final String nameContainsProductInfo) {
|
||||
return identifyDriver(nameContainsProductInfo, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过JDBC URL等信息识别JDBC驱动名
|
||||
*
|
||||
* @param nameContainsProductInfo 包含数据库标识的字符串
|
||||
* @param classLoader 类加载器,{@code null}表示默认上下文的类加载器
|
||||
* @return 驱动
|
||||
*/
|
||||
public static String identifyDriver(String nameContainsProductInfo, final ClassLoader classLoader) {
|
||||
if (StrUtil.isBlank(nameContainsProductInfo)) {
|
||||
return null;
|
||||
}
|
||||
@ -88,15 +98,15 @@ public class DialectFactory implements DriverNamePool{
|
||||
|
||||
// 首先判断是否为标准的JDBC URL,截取jdbc:xxxx:中间部分
|
||||
final String name = ReUtil.getGroup1("jdbc:(.*?):", nameContainsProductInfo);
|
||||
if(StrUtil.isNotBlank(name)){
|
||||
if (StrUtil.isNotBlank(name)) {
|
||||
nameContainsProductInfo = name;
|
||||
}
|
||||
|
||||
String driver = null;
|
||||
if (nameContainsProductInfo.contains("mysql") || nameContainsProductInfo.contains("cobar")) {
|
||||
driver = ClassLoaderUtil.isPresent(DRIVER_MYSQL_V6) ? DRIVER_MYSQL_V6 : DRIVER_MYSQL;
|
||||
driver = ClassLoaderUtil.isPresent(DRIVER_MYSQL_V6, classLoader) ? DRIVER_MYSQL_V6 : DRIVER_MYSQL;
|
||||
} else if (nameContainsProductInfo.contains("oracle")) {
|
||||
driver = ClassLoaderUtil.isPresent(DRIVER_ORACLE) ? DRIVER_ORACLE : DRIVER_ORACLE_OLD;
|
||||
driver = ClassLoaderUtil.isPresent(DRIVER_ORACLE, classLoader) ? DRIVER_ORACLE : DRIVER_ORACLE_OLD;
|
||||
} else if (nameContainsProductInfo.contains("postgresql")) {
|
||||
driver = DRIVER_POSTGRESQL;
|
||||
} else if (nameContainsProductInfo.contains("sqlite")) {
|
||||
@ -161,12 +171,13 @@ public class DialectFactory implements DriverNamePool{
|
||||
|
||||
/**
|
||||
* 获取共享方言
|
||||
*
|
||||
* @param ds 数据源,每一个数据源对应一个唯一方言
|
||||
* @return {@link Dialect}方言
|
||||
*/
|
||||
public static Dialect getDialect(final DataSource ds) {
|
||||
Dialect dialect = DIALECT_POOL.get(ds);
|
||||
if(null == dialect) {
|
||||
if (null == dialect) {
|
||||
// 数据源作为锁的意义在于:不同数据源不会导致阻塞,相同数据源获取方言时可保证互斥
|
||||
//noinspection SynchronizationOnLocalVariableOrMethodParameter
|
||||
synchronized (ds) {
|
||||
|
@ -61,8 +61,6 @@ public class DruidDSFactory extends AbstractDSFactory {
|
||||
ds.configFromPropety(druidProps);
|
||||
|
||||
//issue#I4ZKCW 某些非属性设置单独设置
|
||||
final String[] specialKeys = {"druid.connectionErrorRetryAttempts", "druid.breakAfterAcquireFailure"};
|
||||
|
||||
// connectionErrorRetryAttempts
|
||||
final String connectionErrorRetryAttemptsKey = "druid.connectionErrorRetryAttempts";
|
||||
if(druidProps.containsKey(connectionErrorRetryAttemptsKey)){
|
||||
|
Loading…
x
Reference in New Issue
Block a user