So I wrote a port of OPath for Java object model (less than 200 lines of real code). Following example should explain how it can add some value to your development efforts:
Consider an example of code for simple Accessible Swing Table :
If you are writing a UI test to see specific table's column heading, you just write following
Collection<Object> findAll = OPathReflectiveInterpreter.findAll(frame, "//dataModel//@val\\$column.*");
This is very trivial test, of course. But it is sufficient to express the power of OPath micro-scripting.
If you like to try it out for unit-testing or templating check-out the download here (You will also need opath.jar).
Disclaimer: This is experimental work at best, it might be slow and it might have bugs at this time.