1 reply
Note: Jakarta Commons BeanUtils now has such a BeanComparator in its API [In fact, very like it as it came from the code that lead to the tip and separate work from Eric Pugh].
This can be found at:
http://jakarta.apache.org/commons/beanutils.html
and the API seen at:
http://jakarta.apache.org/commons/beanutils/api/org/apache/commons/beanutils/BeanComparator.html
Expect a getComparator/setComparator pair of methods to be added in the next release.
I've often found it hard to get people to click as to how useful BeanComparator is. Once it clicks, it clicks, but until then it's hard to convince people that BeanComparator does away with 95% of your comparators :)
[Also, pay attention to ReverseComparator in the Commons Collections project. Much nicer than using ASC/DESC flags]
This discussion is closed to new replies.
Trending Web Development posts
Sort by Trending