Do you know a good java object graph visitor library?
I want to visit an object and its sub components and perform some actions when some conditions are matched.
Example usage:
- on a huge domain object graph, reset
each id tonull - on a huge domain object graph, replace each
Setwith aTreeSet
instance containing the same
elements.
I want a library, not custom code because traversing an Object graph can be tricky. You have to handle collections, arrays, proxies, and so on…
I have think about reuse part of XStream to achieve this, but it doesn’t look so easy: Xstream visitor is more oriented on object transformation than object self modification.
I’ve been looking for the same thing, and found this.
http://code.google.com/p/behaim/