Recursive Method Lookup (Java) #8062
-
I'd like to be able to query all method invocation chains in a recursive query from a starting point. I'm able to get a single lookup, but I'm looking for some advice on how to recursively perform the lookup. In my example, I'm looking to query every Spring Bean defined in a database and identify the methods without arguments. I'd like to then recursively query the return types of those methods and see what methods without arguments can be called. Ideally the output would be in a
For example on a bean returning a Spring defines a sample Bean here at 2.2.3.3.
I'd expect to see foo.init and bar.cleanup along with all of the Object methods. If the Foo or Bar class defined additional methods, then I'd want to recursively grab the methods on their return types as well. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Greetings, thanks for getting in touch with this question! Would something similar to the following (adapted to handle your specific use-case of beans rather than just any method) do what you need:
In particular, what this is doing is pulling out the logic of going one step further in the search into the This doesn't quite satisfy your requirement for the output to be in |
Beta Was this translation helpful? Give feedback.
Greetings, thanks for getting in touch with this question! Would something similar to the following (adapted to handle your specific use-case of beans rather than just any method) do what you need:
In particular, what this is doing is pulling out the logic of going one step further in the search into the
getNextStep
predicate. Then we can use the+
operator to indicate that we want everything that is reachable in …