package com.abin.lee.apache;
import java.lang.reflect.InvocationTargetException;
import org.apache.commons.beanutils.BeanUtils;
import com.abin.lee.apache.bean.AirBean;
import com.abin.lee.apache.bean.SkyBean;
public class ApacheBeanUtils {
public static void main(String[] args) throws Exception {
AirBean air=new AirBean();
BeanUtils.setProperty(air, "id", "1");
BeanUtils.setProperty(air, "name", "abin");
SkyBean sky=new SkyBean();
BeanUtils.copyProperties(sky, air);
// String id=BeanUtils.getProperty(sky, "id");
// String name=BeanUtils.getProperty(sky, "name");
// System.out.println("id="+id);
// System.out.println("name="+name);
System.out.println("id="+sky.getId());
System.out.println("name="+sky.getName());
System.out.println("name="+sky.getClass());
}
}