Declare default __invoke method body.
14330
private function declareStructure()
    {
        $perform = $this->method('perform')->setAccess(MethodDeclaration::ACCESS_PROTECTED);
        $perform->setComment("Perform command");

        $this->constant('NAME');
        $this->constant('NAME')->setValue('');

        $this->constant('DESCRIPTION');
        $this->constant('DESCRIPTION')->setValue('');

        $this->constant('ARGUMENTS');
        $this->constant('ARGUMENTS')->setValue([]);

        $this->constant('OPTIONS');
        $this->constant('OPTIONS')->setValue([]);
    }
818186
public Object invoke (Object object, String methodName, Object... args) {
		return invoke(object, getIndex(methodName, args == null ? 0 : args.length), args);
	}
1263099
def invoke_command (self, cmd, args, **kwargs):
        """"""
        new_kwargs = kwargs.copy ()
        new_kwargs['argv0'] = kwargs['argv0'] + ' ' + cmd.name
        new_kwargs['parent'] = self
        new_kwargs['parent_kwargs'] = kwargs
        return cmd.invoke_with_usage (args, **new_kwargs)
1045409
public Object invokeMethod(Class sender, Object object, String methodName, Object[] originalArguments, boolean isCallToSuper, boolean fromInsideClass) {
        if (invokeMethodMethod != null) {
            MetaClassHelper.unwrap(originalArguments);
            return invokeMethodMethod.invoke(object, new Object[]{methodName, originalArguments});
        }
        return super.invokeMethod(sender, object, methodName, originalArguments, isCallToSuper, fromInsideClass);
    }
800636
protected void invokeMethodHandler(ClassMethod method, MethodInformation methodInfo, boolean addReturnInstruction, BytecodeMethodResolver bytecodeMethodResolver, boolean addProceed, ClassMethod staticConstructor) {
        // now we need to build the bytecode. The order we do this in is as
        // follows:
        // load methodHandler
        // dup the methodhandler
        // invoke isDisabledHandler on the method handler to figure out of this is
        // a self invocation.

        // load this
        // load the method object
        // load the proceed method that invokes the superclass version of the
        // current method
        // create a new array the same size as the number of parameters
        // push our parameter values into the array
        // invokeinterface the invoke method
        // add checkcast to cast the result to the return type, or unbox if
        // primitive
        // add an appropriate return instruction
        final CodeAttribute b = method.getCodeAttribute();
        b.aload(0);
        getMethodHandlerField(method.getClassFile(), b);

        if (addProceed) {
            b.dup();

            // get the Stack
            b.invokestatic(InterceptionDecorationContext.class.getName(), "getStack", "()" + DescriptorUtils.makeDescriptor(Stack.class));

            // this is a self invocation optimisation
            // test to see if this is a self invocation, and if so invokespecial the
            // superclass method directly
            // Do not optimize in case of private and default methods
            if (!Reflections.isDefault(methodInfo.getMethod()) && !Modifier.isPrivate(method.getAccessFlags())) {
                b.dupX1(); // Handler, Stack -> Stack, Handler, Stack
                b.invokevirtual(COMBINED_INTERCEPTOR_AND_DECORATOR_STACK_METHOD_HANDLER_CLASS_NAME, "isDisabledHandler",
                        "(" + DescriptorUtils.makeDescriptor(Stack.class) + ")" + BytecodeUtils.BOOLEAN_CLASS_DESCRIPTOR);
                b.iconst(0);
                BranchEnd invokeSuperDirectly = b.ifIcmpeq();
                // now build the bytecode that invokes the super class method
                b.pop2(); // pop Stack and Handler
                b.aload(0);
                // create the method invocation
                b.loadMethodParameters();
                b.invokespecial(methodInfo.getDeclaringClass(), methodInfo.getName(), methodInfo.getDescriptor());
                b.returnInstruction();
                b.branchEnd(invokeSuperDirectly);
            }
        } else {
            b.aconstNull();
        }

        b.aload(0);
        bytecodeMethodResolver.getDeclaredMethod(method, methodInfo.getDeclaringClass(), methodInfo.getName(), methodInfo.getParameterTypes(), staticConstructor);

        if (addProceed) {
            if (Modifier.isPrivate(method.getAccessFlags())) {
                // If the original method is private we can't use WeldSubclass.method$$super() as proceed
                bytecodeMethodResolver.getDeclaredMethod(method, methodInfo.getDeclaringClass(), methodInfo.getName(), methodInfo.getParameterTypes(),
                        staticConstructor);
            } else {
                bytecodeMethodResolver.getDeclaredMethod(method, method.getClassFile().getName(), methodInfo.getName() + SUPER_DELEGATE_SUFFIX,
                        methodInfo.getParameterTypes(), staticConstructor);
            }
        } else {
            b.aconstNull();
        }

        b.iconst(methodInfo.getParameterTypes().length);
        b.anewarray(Object.class.getName());

        int localVariableCount = 1;

        for (int i = 0; i < methodInfo.getParameterTypes().length; ++i) {
            String typeString = methodInfo.getParameterTypes()[i];
            b.dup(); // duplicate the array reference
            b.iconst(i);
            // load the parameter value
            BytecodeUtils.addLoadInstruction(b, typeString, localVariableCount);
            // box the parameter if necessary
            Boxing.boxIfNessesary(b, typeString);
            // and store it in the array
            b.aastore();
            if (isWide(typeString)) {
                localVariableCount = localVariableCount + 2;
            } else {
                localVariableCount++;
            }
        }
        // now we have all our arguments on the stack
        // lets invoke the method
        b.invokeinterface(StackAwareMethodHandler.class.getName(), INVOKE_METHOD_NAME, LJAVA_LANG_OBJECT, INVOKE_METHOD_PARAMETERS);
        if (addReturnInstruction) {
            // now we need to return the appropriate type
            if (methodInfo.getReturnType().equals(BytecodeUtils.VOID_CLASS_DESCRIPTOR)) {
                b.returnInstruction();
            } else if (isPrimitive(methodInfo.getReturnType())) {
                Boxing.unbox(b,method.getReturnType());
                b.returnInstruction();
            } else {
                b.checkcast(BytecodeUtils.getName(methodInfo.getReturnType()));
                b.returnInstruction();
            }
        }
    }
756071
public void writeDefaultMethodCode(String strMethodName, String strMethodReturns, String strMethodInterface, String strClassName)
    {
        String strBaseClass, strMethodVariables = DBConstants.BLANK;
        Record recClassInfo = this.getMainRecord();
        LogicFile recLogicFile = (LogicFile)this.getRecord(LogicFile.LOGIC_FILE_FILE);
        strBaseClass = recClassInfo.getField(ClassInfo.BASE_CLASS_NAME).getString();  // Get the base class name
        strMethodVariables = this.getMethodVariables(strMethodInterface);
        if (strClassName.equals(strMethodName))
        { // Call super.NewC initializer
            if (strMethodVariables.equalsIgnoreCase("VOID"))
                strMethodVariables = "";
            if (strMethodInterface.length() == 0)
                m_StreamOut.writeit("\tsuper();\n");
            else
            {
                boolean bSuperFound = false;
                if ((strMethodReturns.length() == 0) || (strMethodReturns.equalsIgnoreCase("void")))
                    if (recLogicFile.getField(LogicFile.LOGIC_SOURCE).getLength() > 0)
                        strMethodReturns =  strMethodVariables;   // Special case - if you have code, pass the default variables
                if ((strMethodReturns.length() == 0) || (strMethodReturns.equalsIgnoreCase("void")))
                    m_StreamOut.writeit("\tthis();\n\tthis.init(" + strMethodVariables + ");\n");
                else
                {   // Special Case - Different variables are passed in, must supply and init method w/the correct interface
                    if (!strMethodReturns.equalsIgnoreCase("INIT"))
                    {
                        m_StreamOut.writeit("\tthis();\n\tthis.init(" + strMethodVariables + ");\n");
                        m_StreamOut.writeit("}\n");
                        m_strLastMethodInterface = strMethodInterface;
                        m_strLastMethod = strMethodName;
                        this.writeMethodInterface(null, "init", "void", strMethodInterface, "", "Initialize class fields", null);                   
                        if (strMethodReturns.equalsIgnoreCase("VOID"))
                            strMethodReturns = "";
                        this.writeClassInitialize(true);
                    }
                    else
                        bSuperFound = true; // Don't call init.super();
                    if (recLogicFile.getField(LogicFile.LOGIC_SOURCE).getString().length() != 0)
                    {
                        m_StreamOut.setTabs(+1);
//x                     bSuperFound = m_MethodsOut.writeit(recLogicFile.getField(LogicFile.LOGIC_SOURCE).getString() + "\n");
                        bSuperFound = bSuperFound | this.writeTextField(recLogicFile.getField(LogicFile.LOGIC_SOURCE), strBaseClass, "init", strMethodReturns, strClassName);
                        m_StreamOut.setTabs(-1);
                    }
                    if (!bSuperFound)
                        m_StreamOut.writeit("\tsuper.init(" + strMethodReturns + ");\n");
                }
            }
        }
        else
        { // Call super.NewC
            if (!strMethodName.equals("setupSFields"))
            {
                String beginString = "";
                if (strMethodReturns.length() == 0)
                    beginString = "return ";
                m_StreamOut.writeit("\t" + beginString + "super." + strMethodName + "(" + strMethodVariables + ");\n");
            }
        else
            this.writeSetupSCode(strMethodName, strMethodReturns, strMethodInterface, strClassName);
        }
    }
191810
def invoke(self, method, relpath=None, params=None, data=None, headers=None):
    
    path = self._join_uri(relpath)
    resp = self._client.execute(method,
                                path,
                                params=params,
                                data=data,
                                headers=headers)
    try:
      body = resp.read()
    except Exception, ex:
      raise Exception("Command '%s %s' failed: %s" %
                      (method, path, ex))

    self._client.logger.debug(
        "%s Got response: %s%s" %
        (method, body[:32], len(body) > 32 and "..." or ""))

    # Is the response application/json?
    if len(body) != 0 and \
          resp.info().getmaintype() == "application" and \
          resp.info().getsubtype() == "json":
      try:
        json_dict = json.loads(body)
        return json_dict
      except Exception, ex:
        self._client.logger.exception('JSON decode error: %s' % (body,))
        raise ex
    else:
      return body
92081
function invoke(moduleName, method, extraArgs, callback) {
    var module = self.modules[moduleName];
    var invoke = module[method];
    if (invoke) {
      if (invoke.length === (1 + extraArgs.length)) {
        return invoke.apply(module, extraArgs.concat([callback]));
      } else if (invoke.length === extraArgs.length) {
        return setImmediate(function () {
          try {
            invoke.apply(module, extraArgs);
          } catch (e) {
            return callback(e);
          }
          return callback(null);
        });
      } else {
        return callback(moduleName + ' module: your ' + method + ' method must take ' + extraArgs.length + ' arguments, plus an optional callback.');
      }
    } else {
      return setImmediate(callback);
    }
  }
1286970
@SuppressWarnings("unchecked")
    private void decorateCanInvoke(Map<String, Object> mBeanInfo, String method, boolean canInvoke) {
        LOG.trace("decorateCanInvoke: {} - {}", method, canInvoke);

        // op
        String[] methodNameAndArgs = method.split("[()]");
        Object op = ((Map<String, Object>) mBeanInfo.get("op")).get(methodNameAndArgs[0]);
        if (op instanceof List) { // for method overloading
            List<Map<String, Object>> overloaded = (List<Map<String, Object>>) op;
            for (Map<String, Object> m : overloaded) {
                String args = argsToString((List<Map<String, String>>) m.get("args"));
                if ((methodNameAndArgs.length == 1 && args.equals(""))
                    || (methodNameAndArgs.length > 1 && args.equals(methodNameAndArgs[1]))) {
                    m.put("canInvoke", canInvoke);
                    LOG.trace("  op: {}({}) - {}", methodNameAndArgs[0], args, m.get("canInvoke"));
                    break;
                }
            }
        } else {
            ((Map<String, Object>) op).put("canInvoke", canInvoke);
            LOG.trace("  op: {} - {}", method, ((Map<String, Object>) op).get("canInvoke"));
        }

        // opByString
        Map<String, Object> opByString = (Map<String, Object>) mBeanInfo.get("opByString");
        Map<String, Object> opByStringMethod = (Map<String, Object>) opByString.get(method);
        opByStringMethod.put("canInvoke", canInvoke);
        LOG.trace("  opByString: {} - {}", method, opByStringMethod.get("canInvoke"));
    }
1167797
public void setMethodDefaults(String method)
  {
        String defaultMethod = m_properties.getProperty(OutputKeys.METHOD);
 
        if((null == defaultMethod) || !defaultMethod.equals(method)
         // bjm - add the next condition as a hack
         // but it is because both output_xml.properties and
         // output_unknown.properties have the same method=xml
         // for their default. Otherwise we end up with
         // a ToUnknownStream wraping a ToXMLStream even
         // when the users says method="xml"
         //
         || defaultMethod.equals("xml")
         )
        {
            Properties savedProps = m_properties;
            Properties newDefaults = 
                OutputPropertiesFactory.getDefaultMethodProperties(method);
            m_properties = new Properties(newDefaults);
            copyFrom(savedProps, false);
        }
  }
705445
public final Object invoke(MethodInvocation invocation) throws Throwable {
		final Split split = stopwatchSource.start(invocation);
		try {
			return processInvoke(invocation, split);
		} finally {
			split.stop();
		}
	}
137881
def _add_default_branch(self, body):
        """"""
        assert isinstance(body, CodeStatement)
        if isinstance(body, CodeBlock):
            self.else_body = body
        else:
            self.else_body._add(body)
1043160
private synchronized Object invokeTarget(Object base, Object[] pars)
            throws Throwable {
        Reflect.logInvokeMethod("Invoking method (entry): ", this, pars);
        List<Object> params = collectParamaters(base, pars);
        Reflect.logInvokeMethod("Invoking method (after): ", this, params);
        if (getParameterCount() > 0)
            return getMethodHandle().invokeWithArguments(params);
        if (isStatic() || this instanceof ConstructorInvocable)
            return getMethodHandle().invoke();
        return getMethodHandle().invoke(params.get(0));
    }
985354
public static Object invokeMethod(Object obj, String methodName, Object... params) {
        Method method = findMethod(obj, methodName, params);
        return invokeMethod(obj, method, params);
    }
147647
private Object invoke(String methodName, Object returnValueIfNonExistent,
                          Class<?>[] paramTypes, Object[] params)
        throws DocletInvokeException {
            Method meth;
            try {
                meth = docletClass.getMethod(methodName, paramTypes);
            } catch (NoSuchMethodException exc) {
                if (returnValueIfNonExistent == null) {
                    messager.error(Messager.NOPOS, "main.doclet_method_not_found",
                                   docletClassName, methodName);
                    throw new DocletInvokeException();
                } else {
                    return returnValueIfNonExistent;
                }
            } catch (SecurityException exc) {
                messager.error(Messager.NOPOS, "main.doclet_method_not_accessible",
                               docletClassName, methodName);
                throw new DocletInvokeException();
            }
            if (!Modifier.isStatic(meth.getModifiers())) {
                messager.error(Messager.NOPOS, "main.doclet_method_must_be_static",
                               docletClassName, methodName);
                throw new DocletInvokeException();
            }
            ClassLoader savedCCL =
                Thread.currentThread().getContextClassLoader();
            try {
                if (appClassLoader != null) // will be null if doclet class provided via API
                    Thread.currentThread().setContextClassLoader(appClassLoader);
                return meth.invoke(null , params);
            } catch (IllegalArgumentException exc) {
                messager.error(Messager.NOPOS, "main.internal_error_exception_thrown",
                               docletClassName, methodName, exc.toString());
                throw new DocletInvokeException();
            } catch (IllegalAccessException exc) {
                messager.error(Messager.NOPOS, "main.doclet_method_not_accessible",
                               docletClassName, methodName);
                throw new DocletInvokeException();
            } catch (NullPointerException exc) {
                messager.error(Messager.NOPOS, "main.internal_error_exception_thrown",
                               docletClassName, methodName, exc.toString());
                throw new DocletInvokeException();
            } catch (InvocationTargetException exc) {
                Throwable err = exc.getTargetException();
                if (apiMode)
                    throw new ClientCodeException(err);
                if (err instanceof java.lang.OutOfMemoryError) {
                    messager.error(Messager.NOPOS, "main.out.of.memory");
                } else {
                    messager.error(Messager.NOPOS, "main.exception_thrown",
                               docletClassName, methodName, exc.toString());
                    exc.getTargetException().printStackTrace();
                }
                throw new DocletInvokeException();
            } finally {
                Thread.currentThread().setContextClassLoader(savedCCL);
            }
    }
1098376
@Override
  public Object invokeMethod(String name, Object[] args) {
    ISlot slot = findSlot(name, args);
    PojoGestalt gestalt = createGestalt(slot.getType(), args);
    new Sculpturer().$form(gestalt);
    slot.write(gestalt.getSubject());
    return gestalt.getSubject();
  }
1011070
def p_invoke(p):
    
    priority = None
    if len(p) > 5:
        priority = int(p[8])
    p[0] = Trigger(p[2], p[4], priority)