I’m looking for ways to traverse an arbitrary object hierarchy in Java. Obviously, using the reflection API directly is one option but what libraries are built on top of it that could make the task easier?
Specifically I want to grab all the objects referenced directly or indirectly from a base object that implement a given interface. The hierarchy can contain loops, although the objects I’m looking for will form a DAG, so ideally I’d want them to be returned in topological order.
Did you look at Apache BeanUtils yet? -> http://commons.apache.org/beanutils/
I don’t know if they cover everything you need but it’s quite good and easy to use.