noSuchMethod

    0

    0

    shinya-creator

    Invocation i is an object that refers to the method fooMethod on the object instance i. The method fooMethod is not found on the object instance i, so the if statement checks to see if the memberName of the object instance i is the same as the method name fooMethod. If it is, there is aSadly, if the object instance i has any positional arguments or named arguments, the code in the if statement will have to be written to support those values. The return statement tells the caller that there is no method called fooMethod on the object instance i.

    Shortcut: nosuchmethod

    noSuchMethod(Invocation i) {
      if (i.memberName == #tmpMethod) {
        if (i.isMethod && /*add specific conditions here*/) {
          // implement tmpMethod here;
        }
      }
      return super.noSuchMethod(i);
    }
    
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Playground
    • Snippets
    • Cookbooks
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.