org.apache.commons.beanutils.BeanUtils|PropertyUtils(深层拷贝)

		Stu i = new Stu();

		i.setId(1);
		i.setName("zhangsan");

		Stu j = (Stu) BeanUtils.cloneBean(i);

		i.setName("lisi");

		System.out.println(i.getName() + "   " + j.getName());

		Stu i2 = new Stu();

		i2.setId(1);
		i2.setName("zhangsan");
		
		Stu j2 = new Stu();

		PropertyUtils.copyProperties(j2, i2);

		i2.setName("lisi");

		System.out.println(i2.getName() + "   " + j2.getName());

 

你可能感兴趣的:(apache,J#)