Copy Groovy class properties

后端 未结 4 1098
鱼传尺愫
鱼传尺愫 2020-12-01 21:10

I want to copy object properties to another object in a generic way (if a property exists on target object, I copy it from the source object).

My co

4条回答
  •  时光取名叫无心
    2020-12-01 21:57

    Spring BeanUtils.copyProperties will work even if source/target classes are different types. http://docs.spring.io/autorepo/docs/spring/3.2.3.RELEASE/javadoc-api/org/springframework/beans/BeanUtils.html

提交回复
热议问题