zoukankan      html  css  js  c++  java
  • 关于BeanUtils.copyProperties()用法和区别

     这两个类在不同的包下面,而这两个类的copyProperties()方法里面传递的参数赋值是相反的。

      例如:
      a,b为对象
      BeanUtils.copyProperties(a, b);

    1、BeanUtils是org.springframework.beans.BeanUtils, a拷贝到b  

    public static void copyProperties(Object source, Object target)//source 源文件,target 目标文件
            throws BeansException
        {
            copyProperties(source, target, null, (String[])null);
        }

    2、BeanUtils是org.apache.commons.beanutils.BeanUtils,b拷贝到a

    public static void copyProperties(Object dest, Object orig)//dest目标文件,original源文件
            throws IllegalAccessException, InvocationTargetException
        {
            BeanUtilsBean.getInstance().copyProperties(dest, orig);
        }
  • 相关阅读:
    继承性03
    继承性
    Arrays与Math类
    Static关键字
    random模块,time模块,os模块,sys模块
    re模块
    冒泡排序、递归、二分查找
    内置函数
    生成器和生成器表达式
    迭代器
  • 原文地址:https://www.cnblogs.com/leilong/p/8594961.html
Copyright © 2011-2022 走看看