JPath
JPath is a Java framework that provides XPath-like functionality with a modern fluent style for Java objects. It is both - a specification that also comes with an implementation. You can easily use or define filters that select a single object or an arbitrary number of objects with certain attributes from an object graph or set those attributes or objects in the graph. It is well suited for productive and test usage.
The following example shows how all children and children's children of an instance myObject can be retrieved, that match a certain class CertainType. The return values is a Collection, that contains the selected objects.
JPath.getSelector()
.descendants()
.retain(CertainType.class)
.select(myObject);
The source code below shows how all beans of an application are processed and all those that use a certain service will receive a mock service instead. Really useful for unit tests or in many other cases.
JPath.getWriter()
.children()
.retain(MyService.class)
.SetTo(myMockService)
.process(getBeans());
There is currently no final release yet that can be downloaded. Please be patient until the end of february.