Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Generic equivalent to BeanComparator from Commons BeanUtils

I would like to know if there's an equivalent for BeanComparator from Commons BeanUtils which would allow using generics (and also wouldn't rely on Commons Collections).

like image 313
Alexey Grigorev Avatar asked Mar 13 '12 09:03

Alexey Grigorev


1 Answers

The 1.9.x version of commons-beanutils is generics compatible. Just update to the current release version (1.9.2 as of June 2014) and you will have what you desire. http://commons.apache.org/proper/commons-beanutils/apidocs/org/apache/commons/beanutils/BeanComparator.html

You can download it here or use the maven artifacts. http://commons.apache.org/proper/commons-beanutils/

That said, it is generally better to not use this reflection mechanism because the performance hit and loss of control will probably not be worth the minor savings in lines of code.

like image 99
Aaron Zeckoski Avatar answered Oct 02 '22 08:10

Aaron Zeckoski