mirror of
https://gitee.com/mybatis-flex/mybatis-flex.git
synced 2025-12-08 09:38:26 +08:00
style: 工具类添加私有构造器。
This commit is contained in:
parent
5b2ab0ea69
commit
af85476c82
@ -1,17 +1,17 @@
|
|||||||
/**
|
/*
|
||||||
* Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com).
|
* Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com).
|
||||||
* <p>
|
* <p>
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
* <p>
|
* <p>
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* <p>
|
* <p>
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package com.mybatisflex.core.query;
|
package com.mybatisflex.core.query;
|
||||||
|
|
||||||
@ -24,11 +24,13 @@ import java.util.Map;
|
|||||||
|
|
||||||
public class If {
|
public class If {
|
||||||
|
|
||||||
|
private If() {
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 判断对象是否为空
|
* 判断对象是否为空
|
||||||
*/
|
*/
|
||||||
public static boolean isNull(Object object) {
|
public static boolean isNull(Object object) {
|
||||||
return object == null;
|
return object == null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -41,26 +43,27 @@ public class If {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 查看某个对象是否为空,支持数组、集合、map 等
|
* 查看某个对象是否为空,支持数组、集合、map 等
|
||||||
|
*
|
||||||
* @param object
|
* @param object
|
||||||
*/
|
*/
|
||||||
public static boolean notEmpty(Object object){
|
public static boolean notEmpty(Object object) {
|
||||||
if (object == null){
|
if (object == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (object instanceof Collection){
|
if (object instanceof Collection) {
|
||||||
return !((Collection<?>) object).isEmpty();
|
return !((Collection<?>) object).isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ClassUtil.isArray(object.getClass())){
|
if (ClassUtil.isArray(object.getClass())) {
|
||||||
return Array.getLength(object) >0;
|
return Array.getLength(object) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (object instanceof Map){
|
if (object instanceof Map) {
|
||||||
return !((Map<?, ?>) object).isEmpty();
|
return !((Map<?, ?>) object).isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (object instanceof String){
|
if (object instanceof String) {
|
||||||
return StringUtil.isNotBlank((String) object);
|
return StringUtil.isNotBlank((String) object);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@ -69,18 +72,20 @@ public class If {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 查看某个对象是否为空数据 或者 null
|
* 查看某个对象是否为空数据 或者 null
|
||||||
|
*
|
||||||
* @param object
|
* @param object
|
||||||
*/
|
*/
|
||||||
public static boolean isEmpty(Object object){
|
public static boolean isEmpty(Object object) {
|
||||||
return !notEmpty(object);
|
return !notEmpty(object);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查看某个 string 对象是否有文本内容
|
* 查看某个 string 对象是否有文本内容
|
||||||
|
*
|
||||||
* @param object
|
* @param object
|
||||||
*/
|
*/
|
||||||
public static boolean hasText(Object object){
|
public static boolean hasText(Object object) {
|
||||||
return object != null && StringUtil.isNotBlank((String) object);
|
return object != null && StringUtil.isNotBlank((String) object);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user