Closed
Description
Not really sure if this is the right place for a question, but I saw you answer here, so I'll give it a try.
First off, amazing library!!
I am trying to figure something and I can't find any example in your code on how to do it.
I created a custom visitor.
Using the accept function I am able to traverse all changes.
I am trying to get the actual element behind a node (element is in a collection).
Once I reach such an element I wrote the following code that works:
Map:
Integer key = (Integer) ((MapElement) node.getPathElement()).getKey();
List/Set:
SomeObject object = (SomeObject) ((CollectionElement) node.getPathElement()).getItem();
These seem to work, but I wonder...
- Is there an easier way to perform this task?
- How can I get the value in a mapElement?
Thanks for this great library!