判断对象是否为空 Object = null String = "","null","undefined" List size=0 @param object @return
(Object object)
| 23 | * @return |
| 24 | */ |
| 25 | public static boolean isEmpty(Object object) |
| 26 | { |
| 27 | if(object instanceof String){ |
| 28 | if(object == null||object.toString().trim().equals("")||object.toString().trim().equalsIgnoreCase("null")||object.toString().equals("undefined")) |
| 29 | return true; |
| 30 | }else if(object instanceof List<?>){ |
| 31 | if(object == null ||((List<?>)object).size()==0) |
| 32 | return true; |
| 33 | }else if(object == null){ |
| 34 | return true; |
| 35 | } |
| 36 | return false; |
| 37 | } |
| 38 | |
| 39 | // 从request中获取值 |
| 40 | public static String getValueFromRequest(HttpServletRequest request, String name){ |
no outgoing calls