How do I figure out which method gradle delegates to?

Hey there, I’m still learning gradle.

I’m the kind of person who wants to dig into the DSL details and understand how it works syntactically.

Let me illustrate my confusion using this example:

I understand this block:

dependencies {
    configurationName dependencyNotation

will add a new dependency to the configuration, and from Project - Gradle DSL Version 7.3.3 I know the “dependencies” script block make the delegate of the closure to be DependencyHandler , and from that page, I can infer that the above syntax is actually calling the add method of the DependencyHandler class because the parameters match and as does the semantics.

But my question is, how does Gradle know to use the add method, given there is no “add” method explicitly called? what is the magic behind it?
I think there are many other scenarios where a similar syntax works such way, e.g.
a block of:

configurations {

will delegates to ConfigurationContainer’s create method.

I think understanding how this method delegation magic behind the scene will tremendously help me navigate the gradle API docs and tutorials.