Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between invokeMethod and methodMissing?

Tags:

groovy

In Groovy, what are the main differences between the invokeMethod and methodMissing methods, and are there clear guidelines when one should be used over the other?

like image 657
Armand Avatar asked Oct 21 '25 19:10

Armand


1 Answers

When to use what: Always use methodMissing.

@FooBarUser. Thanks for pointing me to a page with wrong documentation, the page will be changed soon.

invokeMethod is not in general called for every method invocation, only in some situations. Which is also why methodMissing was added, to have a method with a clear role, unlike the sometimes fallback, sometimes frontend method invokeMethod

like image 92
blackdrag Avatar answered Oct 25 '25 00:10

blackdrag