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 to
null
- on a huge domain object graph, replace each
Set
with 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.