-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathOgnl.java
60 lines (55 loc) · 1.13 KB
/
Ognl.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import com.hotent.core.util.BeanUtils;
/**
* Ognl工具类
* <p>
* 主要是为了在ognl表达式访问静态方法时可以减少长长的类名称编写 Ognl访问静态方法的表达式
* </p>
*
* @class@method(args) 示例使用:
* <pre>
* <if test="@Ognl@isNotEmpty(userId)">
* and user_id = #{userId}
* </if>
* </pre>
*
* @author badqiu
*/
public class Ognl {
/**
* 可以用于判断 Map,Collection,String,Array,Long是否为空
*
* @param o
* java.lang.Object.
* @return boolean.
*/
public static boolean isEmpty(Object o) throws IllegalArgumentException {
return BeanUtils.isEmpty(o);
}
/**
* 可以用于判断 Map,Collection,String,Array是否不为空
*
* @param c
* @return
*/
public static boolean isNotEmpty(Object o) {
return !isEmpty(o);
}
/**
* 可以用于判断Long类型是否不为空
*
* @param c
* @return
*/
public static boolean isNotEmpty(Long o) {
return !isEmpty(o);
}
/**
* 判断是否为数字
*
* @param o
* @return
*/
public static boolean isNumber(Object o) {
return BeanUtils.isNumber(o);
}
}