Apache Commons logo Commons BeanUtils

Commons BeanUtils Bean Collections

Dealing with collections of beans is a common feature of development in Java. A lot of time is spent creating bean-specific implementations for standard collection manipulators such as functors and comparators.

BeanUtils Bean collections is a library intended to improve developer productivity by using sophisticated bean introspection (from BeanUtils) to allow general library classes to be used (rather than creating bean specific implementation classes).

But won't this be slower? Yes, reflection is slower than direct references but in real life applications, this is typically insignificant. So why not use these classes to speed development and then substitute faster implementations only where the profiler indicates there is a problem :)

Quick-Quick Guide To Functors

Many of the classes in bean-collections are functor implementations specialized for bean properties. This is a very quick guide (aimed to let java developer know why functors make for elegant code).

The word functor is mathematical in origin but comes into object oriented development from functional and logic coding. In Java terms, a functor is a function that is encapsulated as an object (and so can be manipulated as an object). This allows elegant, concise and powerful techniques to be used. For example, Commons Collections contains utilities that allow functions (as functors) to be easily applied to Collections.

This is actually pretty useful when it comes to collections of beans. It's a common problem to want to extract information from a collection of beans or to change all properties to a particular value. Functors can be a particularly elegant way to do this. So try them! You might just like them!

For more information about functors, please read the introduction to the Commons Functor component.

Releases

BeanUtils Bean-Collections is distributed as an optional jar within the main beanutils distribution. For details, see the main BeanUtils website