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