`
michaels888
  • 浏览: 6968 次
社区版块
存档分类
最新评论

TestPropertyUtils

    博客分类:
  • JDBC
阅读更多

要导入beanutils.jar、logging.jar两个包

用来将获取的数据封装到javabean对应的属性中

public class TestPropertyUtils {
 @Test
 public void testPropertyUtils() throws Exception, InvocationTargetException, NoSuchMethodException{
  Customer customer = new Customer();
  PropertyUtils.setProperty(customer, "id", 5);
  PropertyUtils.setProperty(customer, "name", "shawn");
  PropertyUtils.setProperty(customer, "email", "shawn@163.com");
  PropertyUtils.setProperty(customer, "birth", new Date(new java.util.Date().getTime()));
  
  System.out.println(customer);
  
 }
}

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics