少年阿賓

          那些青春的歲月

            BlogJava :: 首頁 :: 聯系 :: 聚合  :: 管理
            500 Posts :: 0 Stories :: 135 Comments :: 0 Trackbacks

          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());
           }

          }

          posted on 2012-10-19 12:50 abin 閱讀(577) 評論(0)  編輯  收藏 所屬分類: Apache Commons

          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          主站蜘蛛池模板: 鸡东县| 札达县| 江川县| 达拉特旗| 盐池县| 泰来县| 大邑县| 怀安县| 南开区| 泗洪县| 邓州市| 杨浦区| 勃利县| 竹北市| 阳高县| 隆德县| 纳雍县| 济阳县| 瓦房店市| 建阳市| 临潭县| 临沧市| 垦利县| 新源县| 平阴县| 汤原县| 道孚县| 鄂伦春自治旗| 黄浦区| 通山县| 高邮市| 聂荣县| 海宁市| 小金县| 山丹县| 堆龙德庆县| 苍溪县| 荔波县| 边坝县| 醴陵市| 大余县|