java中将两个对象中相同的元素的值进行传递

java中将两个对象中相同的元素的值进行传递

import org.apache.commons.beanutils.BeanUtils;


StockInquiryDetailHistory stockInquiryDetailHistory = new StockInquiryDetailHistory();
		// BeanUtils.copyProperties(A,B); 	是B中的值付给A
		try {
			 BeanUtils.copyProperties(stockInquiryDetailHistory, stockInquiryDetailVo);
		} catch (IllegalAccessException e) {
			 // TODO Auto-generated catch block
			 e.printStackTrace();
		} catch (InvocationTargetException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} 

maven中需要引入的包

        <dependency>
			<groupId>commons-beanutils</groupId>
			<artifactId>commons-beanutils</artifactId>
			<version>1.7.0</version>
		</dependency>

你可能感兴趣的:(java中将两个对象中相同的元素的值进行传递)