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
最新推荐文章于 2020-06-24 18:43:20 发布