+优化V.isEmpty(Object), V.notEmpty(Object)校验实现
This commit is contained in:
parent
136e83d33a
commit
72b0bd703c
|
@ -5,8 +5,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|||
/**
|
||||
* 基础CRUD的父类Mapper
|
||||
* @author Mazhicheng
|
||||
* @version 2018/12/22
|
||||
* Copyright © www.dibo.ltd
|
||||
* @version v2.0
|
||||
* @date 2018/12/22
|
||||
*/
|
||||
public interface BaseCrudMapper<T> extends BaseMapper<T> {
|
||||
|
||||
|
|
|
@ -5,8 +5,8 @@ import com.diboot.core.entity.Metadata;
|
|||
/**
|
||||
* 元数据Mapper
|
||||
* @author Mazhicheng
|
||||
* @version 2018/12/22
|
||||
* Copyright © www.dibo.ltd
|
||||
* @version v2.0
|
||||
* @date 2018/12/22
|
||||
*/
|
||||
public interface MetadataMapper extends BaseCrudMapper<Metadata> {
|
||||
|
||||
|
|
|
@ -22,7 +22,21 @@ public class V {
|
|||
* @return
|
||||
*/
|
||||
public static boolean isEmpty(Object obj){
|
||||
return obj == null;
|
||||
if(obj instanceof String){
|
||||
return isEmpty((String)obj);
|
||||
}
|
||||
else if(obj instanceof Collection){
|
||||
return isEmpty((Collection)obj);
|
||||
}
|
||||
else if(obj instanceof Map){
|
||||
return isEmpty((Map)obj);
|
||||
}
|
||||
else if(obj instanceof String[]){
|
||||
return isEmpty((String[])obj);
|
||||
}
|
||||
else{
|
||||
return obj == null;
|
||||
}
|
||||
}
|
||||
|
||||
/***
|
||||
|
@ -67,7 +81,21 @@ public class V {
|
|||
* @return
|
||||
*/
|
||||
public static boolean notEmpty(Object obj){
|
||||
return obj != null;
|
||||
if(obj instanceof String){
|
||||
return notEmpty((String)obj);
|
||||
}
|
||||
else if(obj instanceof Collection){
|
||||
return notEmpty((Collection)obj);
|
||||
}
|
||||
else if(obj instanceof Map){
|
||||
return notEmpty((Map)obj);
|
||||
}
|
||||
else if(obj instanceof String[]){
|
||||
return notEmpty((String[])obj);
|
||||
}
|
||||
else{
|
||||
return obj != null;
|
||||
}
|
||||
}
|
||||
|
||||
/***
|
||||
|
|
Loading…
Reference in New Issue