package cn.itcast.user.service;
import java.util.Map;
import java.util.UUID;
import org.apache.commons.beanutils.BeanUtils;
public class CommonUtils {
public static String uuid() {
return UUID.randomUUID().toString().replace("-", "").toUpperCase();
}
public static <T> T toBean(Map map, Class<T> clazz) {
try {
T bean = clazz.newInstance();
BeanUtils.populate(bean, map);
return bean;
} catch(Exception e) {
throw new RuntimeException(e);
}
}
}
黑马javaweb第14天:CommonUtils.java
猜你喜欢
转载自blog.csdn.net/doublezsx/article/details/80136027
今日推荐
周排行