package com.cloud.common.utils;
|
|
/**
|
* 字符串的一些工具方法
|
* @author bsk
|
*
|
*/
|
public class StringUtil {
|
|
/**
|
* 如果str为null, 则返回空串, 否则返回原来的字符串
|
*/
|
public static String nullToEmpty(String str) {
|
if (str == null) {
|
return "";
|
}
|
return str;
|
}
|
|
|
/* public <T> T preInsert(Object obj,Class<T> t) throws IllegalAccessException, InstantiationException {
|
T sys = t.newInstance();
|
Class<?> cls = obj.getClass();
|
Field[] fields = cls.getDeclaredFields();
|
Field[] beanFields = cla.getDeclaredFields();
|
|
for(Field field:fields) {
|
String fieldName = field.getName();
|
String strSet = "set" + fieldName.substring(0, 1).toUpperCase() + fieldName.substring(1, fieldName.length());
|
Method methodSet = cls.getDeclaredMethod(strSet);
|
Object object = methodSet.invoke(obj);
|
}
|
|
return sys;
|
*//*LoginAppUser attendance =AppUserUtil.getLoginAppUser();
|
if (StringUtils.isNotEmpty(attendance.getId().toString())){
|
try{
|
sys.setUpdateBy(attendance.getUsername());
|
sys.setCreateBy(attendance.getUsername());
|
}catch(Exception e){
|
|
}
|
}
|
sys.setCreateTime(new Date());
|
sys.setUpdateTime(sys.getCreateTime());*//*
|
}*/
|
|
}
|