org.springframework.beans.BeanUtils的用法


s,t为对象
BeanUtils.copyProperties(s, t);  将给定源bean的属性值复制到目标bean中

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

 

BeanUtils.copyProperties(s, t, "Id", "Time");  将给定源bean的属性值复制到目标bean中,忽略Id和Time属性

public static void copyProperties(Object source, Object target, String... ignoreProperties) //source 源,target 目标, ignoreProperties 要忽略的属性名称数组
  throws BeansException {
        copyProperties(source, target, null, ignoreProperties);
    }

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM