Java 类groovy.lang.MissingMethodException 实例源码

项目:Reer    文件:DefaultDependencyHandler.java   
public Object methodMissing(String name, Object args) {
    Object[] argsArray = (Object[]) args;
    Configuration configuration = configurationContainer.findByName(name);
    if (configuration == null) {
        throw new MissingMethodException(name, this.getClass(), argsArray);
    }

    List<?> normalizedArgs = CollectionUtils.flattenCollections(argsArray);
    if (normalizedArgs.size() == 2 && normalizedArgs.get(1) instanceof Closure) {
        return doAdd(configuration, normalizedArgs.get(0), (Closure) normalizedArgs.get(1));
    } else if (normalizedArgs.size() == 1) {
        return doAdd(configuration, normalizedArgs.get(0), null);
    } else {
        for (Object arg : normalizedArgs) {
            doAdd(configuration, arg, null);
        }
        return null;
    }
}
项目:yajsw    文件:PropertyBinding.java   
public void bind() {
    if (!bound) {
        bound = true;
        boundBean = bean;
        boundProperty = propertyName;
        try {
            InvokerHelper.invokeMethodSafe(boundBean, "addPropertyChangeListener", new Object[]{boundProperty, this});
            boundToProperty = true;
        } catch (MissingMethodException mme) {
            try {
                boundToProperty = false;
                InvokerHelper.invokeMethodSafe(boundBean, "addPropertyChangeListener", new Object[]{this});
            } catch (MissingMethodException mme2) {
                throw new RuntimeException("Properties in beans of type " + bean.getClass().getName() + " are not observable in any capacity (no PropertyChangeListener support).");
            }
        }
    }
}
项目:yajsw    文件:PropertyBinding.java   
public void unbind() {
    if (bound) {
        if (boundToProperty) {
            try {
                InvokerHelper.invokeMethodSafe(boundBean, "removePropertyChangeListener", new Object[]{boundProperty, this});
            } catch (MissingMethodException mme) {
                // ignore, too bad so sad they don't follow conventions, we'll just leave the listener attached
            }
        } else {
            try {
                InvokerHelper.invokeMethodSafe(boundBean, "removePropertyChangeListener", new Object[]{this});
            } catch (MissingMethodException mme2) {
                // ignore, too bad so sad they don't follow conventions, we'll just leave the listener attached
            }
        }
        boundBean = null;
        boundProperty = null;
        bound = false;
    }
}
项目:gradle-golang-plugin    文件:DependenciesSettings.java   
@Nullable
public Object methodMissing(@Nonnull String name, @Nullable Object args) {
    final Object[] argsArray = (Object[]) args;
    final Configuration configuration = _project.getConfigurations().findByName(name);
    if (configuration == null) {
        throw new MissingMethodException(name, this.getClass(), argsArray);
    }
    final List<?> normalizedArgs = CollectionUtils.flattenCollections(argsArray);
    if (normalizedArgs.size() == 2 && normalizedArgs.get(1) instanceof Closure) {
        //noinspection rawtypes
        return doAdd(name, normalizedArgs.get(0), (Closure) normalizedArgs.get(1));
    } else if (normalizedArgs.size() == 1) {
        return doAdd(name, normalizedArgs.get(0), null);
    } else {
        for (final Object arg : normalizedArgs) {
            doAdd(name, arg, null);
        }
        return null;
    }
}
项目:groovy    文件:GroovyScriptEngineImpl.java   
private Object invokeImpl(Object thiz, String name, Object... args)
        throws ScriptException, NoSuchMethodException {
    if (name == null) {
        throw new NullPointerException("method name is null");
    }

    try {
        if (thiz != null) {
            return InvokerHelper.invokeMethod(thiz, name, args);
        } else {
            return callGlobal(name, args);
        }
    } catch (MissingMethodException mme) {
        throw new NoSuchMethodException(mme.getMessage());
    } catch (Exception e) {
        throw new ScriptException(e);
    }
}
项目:groovy    文件:PropertyBinding.java   
public void bind() {
    if (!bound) {
        bound = true;
        boundBean = bean;
        boundProperty = propertyName;
        try {
            InvokerHelper.invokeMethodSafe(boundBean, "addPropertyChangeListener", new Object[]{boundProperty, this});
            boundToProperty = true;
        } catch (MissingMethodException mme) {
            try {
                boundToProperty = false;
                InvokerHelper.invokeMethodSafe(boundBean, "addPropertyChangeListener", new Object[]{this});
            } catch (MissingMethodException mme2) {
                throw new RuntimeException("Properties in beans of type " + bean.getClass().getName() + " are not observable in any capacity (no PropertyChangeListener support).");
            }
        }
    }
}
项目:groovy    文件:PropertyBinding.java   
public void unbind() {
    if (bound) {
        if (boundToProperty) {
            try {
                InvokerHelper.invokeMethodSafe(boundBean, "removePropertyChangeListener", new Object[]{boundProperty, this});
            } catch (MissingMethodException mme) {
                // ignore, too bad so sad they don't follow conventions, we'll just leave the listener attached
            }
        } else {
            try {
                InvokerHelper.invokeMethodSafe(boundBean, "removePropertyChangeListener", new Object[]{this});
            } catch (MissingMethodException mme2) {
                // ignore, too bad so sad they don't follow conventions, we'll just leave the listener attached
            }
        }
        boundBean = null;
        boundProperty = null;
        bound = false;
    }
}
项目:groovy    文件:PogoMetaClassSite.java   
public final Object call(Object receiver, Object[] args) throws Throwable {
    if (checkCall(receiver)) {
        try {
            try {
                return metaClass.invokeMethod(receiver, name, args);
            } catch (MissingMethodException e) {
                if (e instanceof MissingMethodExecutionFailed) {
                    throw (MissingMethodException)e.getCause();
                } else if (receiver.getClass() == e.getType() && e.getMethod().equals(name)) {
                    // in case there's nothing else, invoke the object's own invokeMethod()
                    return ((GroovyObject)receiver).invokeMethod(name, args);
                } else {
                    throw e;
                }
            }
        } catch (GroovyRuntimeException gre) {
            throw ScriptBytecodeAdapter.unwrap(gre);
        }
    } else {
      return CallSiteArray.defaultCall(this, receiver, args);
    }
}
项目:groovy    文件:PogoMetaClassSite.java   
public final Object callCurrent(GroovyObject receiver, Object[] args) throws Throwable {
    if (checkCall(receiver)) {
        try {
            try {
                return metaClass.invokeMethod(array.owner, receiver, name, args, false, true);
            } catch (MissingMethodException e) {
                if (e instanceof MissingMethodExecutionFailed) {
                    throw (MissingMethodException)e.getCause();
                } else if (receiver.getClass() == e.getType() && e.getMethod().equals(name)) {
                    // in case there's nothing else, invoke the object's own invokeMethod()
                    return ((GroovyObject)receiver).invokeMethod(name, args);
                } else {
                    throw e;
                }
            }
        } catch (GroovyRuntimeException gre) {
            throw ScriptBytecodeAdapter.unwrap(gre);
        }
    } else {
      return CallSiteArray.defaultCallCurrent(this, receiver, args);
    }
}
项目:groovy    文件:InvokerHelper.java   
static Object invokePogoMethod(Object object, String methodName, Object arguments) {
    GroovyObject groovy = (GroovyObject) object;
    boolean intercepting = groovy instanceof GroovyInterceptable;
    try {
        // if it's a pure interceptable object (even intercepting toString(), clone(), ...)
        if (intercepting) {
            return groovy.invokeMethod(methodName, asUnwrappedArray(arguments));
        }
        //else try a statically typed method or a GDK method
        return groovy.getMetaClass().invokeMethod(object, methodName, asArray(arguments));
    } catch (MissingMethodException e) {
        if (e instanceof MissingMethodExecutionFailed) {
            throw (MissingMethodException) e.getCause();
        } else if (!intercepting && e.getMethod().equals(methodName) && object.getClass() == e.getType()) {
            // in case there's nothing else, invoke the object's own invokeMethod()
            return groovy.invokeMethod(methodName, asUnwrappedArray(arguments));
        } else {
            throw e;
        }
    }
}
项目:groovy    文件:Selector.java   
/**
 * Creates a MethodHandle, which will use the meta class path.
 * This method is called only if no handle has been created before. This
 * is usually the case if the method selection failed.
 */
public void setMetaClassCallHandleIfNedded(boolean standardMetaClass) {
    if (handle!=null) return;
    useMetaClass = true;
    if (LOG_ENABLED) LOG.info("set meta class invocation path");
    Object receiver = getCorrectedReceiver();
    if (receiver instanceof Class) {
        handle = META_CLASS_INVOKE_STATIC_METHOD.bindTo(mc);
        if (LOG_ENABLED) LOG.info("use invokeStaticMethod with bound meta class");
    } else {
        handle = MOP_INVOKE_METHOD.bindTo(mc);
        if (LOG_ENABLED) LOG.info("use invokeMethod with bound meta class");

        if (receiver instanceof GroovyObject) {
            // if the meta class call fails we may still want to fall back to call
            // GroovyObject#invokeMethod if the receiver is a GroovyObject
            if (LOG_ENABLED) LOG.info("add MissingMethod handler for GrooObject#invokeMethod fallback path");
            handle = MethodHandles.catchException(handle, MissingMethodException.class, GROOVY_OBJECT_INVOKER);
        }
    }
    handle = MethodHandles.insertArguments(handle, 1, name);
    if (!spread) handle = handle.asCollector(Object[].class, targetType.parameterCount()-1);
    if (LOG_ENABLED) LOG.info("bind method name and create collector for arguments");
}
项目:groovy    文件:FactoryBuilderSupport.java   
/**
 * This method is the workhorse of the builder.
 *
 * @param methodName the name of the method being invoked
 * @param name       the name of the node
 * @param args       the arguments passed into the node
 * @return the object from the factory
 */
private Object doInvokeMethod(String methodName, Object name, Object args) {
    Reference explicitResult = new Reference();
    if (checkExplicitMethod(methodName, args, explicitResult)) {
        return explicitResult.get();
    } else {
        try {
            return dispatchNodeCall(name, args);
        } catch(MissingMethodException mme) {
            if(mme.getMethod().equals(methodName) && methodMissingDelegate != null) {
                return methodMissingDelegate.call(new Object[]{methodName, args});
            }
            throw mme;
        }
    }
}
项目:groovy    文件:FactoryBuilderSupport.java   
public Object invokeMethod(Object object, String methodName, Object arguments) {
    try {
        return delegate.invokeMethod(object, methodName, arguments);
    } catch (MissingMethodException mme) {
        // attempt builder resolution
        try {
            if (builder.getMetaClass().respondsTo(builder, methodName).isEmpty()) {
                // dispatch to factories if it is not a literal method
                return builder.invokeMethod(methodName, arguments);
            } else {
                return InvokerHelper.invokeMethod(builder, methodName, arguments);
            }
        } catch (MissingMethodException mme2) {
            // chain secondary exception
            Throwable root = mme;
            while (root.getCause() != null) {
                root = root.getCause();
            }
            root.initCause(mme2);
            // throw original
            throw mme;
        }
    }
}
项目:groovy    文件:FactoryBuilderSupport.java   
public Object invokeMethod(Object object, String methodName, Object[] arguments) {
    try {
        return delegate.invokeMethod(object, methodName, arguments);
    } catch (MissingMethodException mme) {
        // attempt builder resolution
        try {
            if (builder.getMetaClass().respondsTo(builder, methodName).isEmpty()) {
                // dispatch to factories if it is not a literal method
                return builder.invokeMethod(methodName, arguments);
            } else {
                return InvokerHelper.invokeMethod(builder, methodName, arguments);
            }
        } catch (MissingMethodException mme2) {
            // chain secondary exception
            Throwable root = mme;
            while (root.getCause() != null) {
                root = root.getCause();
            }
            root.initCause(mme2);
            // throw original
            throw mme;
        }
    }
}
项目:groovy    文件:PropertyTest.java   
public void testListCoercionPropertyOnJFrame() throws Exception {
    if (HeadlessTestSupport.isHeadless()) return;

    try {
        JFrame bean = new JFrame();
        List list = new ArrayList();
        list.add(new Integer(10));
        list.add(new Integer(20));

        InvokerHelper.setProperty(bean, "location", list);
        assertEquals("Should have set a point", new Point(10, 20), bean.getLocation());
    }
    catch (MissingMethodException e) {
        System.out.println("Failed with cause: " + e);
        e.printStackTrace();
        fail("Should not have throw: " + e);
    }
}
项目:Pushjet-Android    文件:NonTransformedModelDslBacking.java   
public Void methodMissing(String name, Object argsObj) {
    Object[] args = (Object[]) argsObj;

    if (!executingDsl.get()) {
        if (name.equals("$")) {
            throw new GradleException(ATTEMPTED_INPUT_SYNTAX_USED_MESSAGE);
        } else {
            throw new MissingMethodException(name, getClass(), args);
        }
    } else {
        if (args.length != 1 || !(args[0] instanceof Closure)) {
            throw new MissingMethodException(name, getClass(), args);
        } else {
            Closure closure = (Closure) args[0];
            getChildPath(name).registerConfigurationAction(closure);
            return null;
        }
    }
}
项目:Pushjet-Android    文件:DefaultDependencyHandler.java   
public Object methodMissing(String name, Object args) {
    Object[] argsArray = (Object[]) args;
    Configuration configuration = configurationContainer.findByName(name);
    if (configuration == null) {
        throw new MissingMethodException(name, this.getClass(), argsArray);
    }

    List<?> normalizedArgs = CollectionUtils.flattenCollections(argsArray);
    if (normalizedArgs.size() == 2 && normalizedArgs.get(1) instanceof Closure) {
        return doAdd(configuration, normalizedArgs.get(0), (Closure) normalizedArgs.get(1));
    } else if (normalizedArgs.size() == 1) {
        return doAdd(configuration, normalizedArgs.get(0), null);
    } else {
        for (Object arg : normalizedArgs) {
            doAdd(configuration, arg, null);
        }
        return null;
    }
}
项目:Pushjet-Android    文件:ConfigureUtil.java   
public static <T> T configureByMap(Map<?, ?> properties, T delegate) {
    DynamicObject dynamicObject = DynamicObjectUtil.asDynamicObject(delegate);

    for (Map.Entry<?, ?> entry : properties.entrySet()) {
        String name = entry.getKey().toString();
        Object value = entry.getValue();

        if (dynamicObject.hasProperty(name)) {
            dynamicObject.setProperty(name, value);
        } else {
            try {
                dynamicObject.invokeMethod(name, value);
            } catch (MissingMethodException e) {
                dynamicObject.setProperty(name, value);
            }
        }
    }

    return delegate;
}
项目:Pushjet-Android    文件:DefaultDependencyHandler.java   
public Object methodMissing(String name, Object args) {
    Object[] argsArray = (Object[]) args;
    Configuration configuration = configurationContainer.findByName(name);
    if (configuration == null) {
        throw new MissingMethodException(name, this.getClass(), argsArray);
    }

    List<?> normalizedArgs = CollectionUtils.flattenCollections(argsArray);
    if (normalizedArgs.size() == 2 && normalizedArgs.get(1) instanceof Closure) {
        return doAdd(configuration, normalizedArgs.get(0), (Closure) normalizedArgs.get(1));
    } else if (normalizedArgs.size() == 1) {
        return doAdd(configuration, normalizedArgs.get(0), null);
    } else {
        for (Object arg : normalizedArgs) {
            doAdd(configuration, arg, null);
        }
        return null;
    }
}
项目:Pushjet-Android    文件:ConfigureUtil.java   
public static <T> T configureByMap(Map<?, ?> properties, T delegate) {
    DynamicObject dynamicObject = DynamicObjectUtil.asDynamicObject(delegate);

    for (Map.Entry<?, ?> entry : properties.entrySet()) {
        String name = entry.getKey().toString();
        Object value = entry.getValue();

        if (dynamicObject.hasProperty(name)) {
            dynamicObject.setProperty(name, value);
        } else {
            try {
                dynamicObject.invokeMethod(name, value);
            } catch (MissingMethodException e) {
                dynamicObject.setProperty(name, value);
            }
        }
    }

    return delegate;
}
项目:Reer    文件:DefaultArtifactHandler.java   
public Object methodMissing(String name, Object arg) {
    Object[] args = (Object[]) arg;
    Configuration configuration = configurationContainer.findByName(name);
    if (configuration == null) {
        throw new MissingMethodException(name, this.getClass(), args);
    }
    List<Object> normalizedArgs = GUtil.flatten(Arrays.asList(args), false);
    if (normalizedArgs.size() == 2 && normalizedArgs.get(1) instanceof Closure) {
        return pushArtifact(configuration, normalizedArgs.get(0), (Closure) normalizedArgs.get(1));
    }
    for (Object notation : args) {
        pushArtifact(configuration, notation, Actions.doNothing());
    }
    return null;
}
项目:Reer    文件:TestNGOptions.java   
public Object methodMissing(String name, Object args) {
    if (suiteXmlBuilder != null) {
        return suiteXmlBuilder.getMetaClass().invokeMethod(suiteXmlBuilder, name, args);
    }

    throw new MissingMethodException(name, getClass(), (Object[])args);
}
项目:Reer    文件:AbstractDynamicObject.java   
@Override
public Object invokeMethod(String name, Object... arguments) throws groovy.lang.MissingMethodException {
    InvokeMethodResult result = new InvokeMethodResult();
    invokeMethod(name, result, arguments);
    if (result.isFound()) {
        return result.getResult();
    }
    throw methodMissingException(name, arguments);
}
项目:Reer    文件:AbstractDynamicObject.java   
public MissingMethodException methodMissingException(String name, Object... params) {
    Class<?> publicType = getPublicType();
    boolean includeDisplayName = hasUsefulDisplayName();
    final String message;
    if (publicType != null && includeDisplayName) {
        message = String.format("Could not find method %s() for arguments %s on %s of type %s.", name, Arrays.toString(params), getDisplayName(), publicType.getName());
    } else if (publicType != null) {
        message = String.format("Could not find method %s() for arguments %s on object of type %s.", name, Arrays.toString(params), publicType.getName());
    } else {
        // Include the display name anyway
        message = String.format("Could not find method %s() for arguments %s on %s.", name, Arrays.toString(params), getDisplayName());
    }
    return new CustomMessageMissingMethodException(name, publicType, message, params);
}
项目:powsybl-core    文件:ActionDslLoaderTest.java   
@Test
public void testUnKnownMethodInScript() {
    ActionDb actionDb = new ActionDslLoader(new GroovyCodeSource(getClass().getResource("/actions2.groovy"))).load(network);
    Action someAction = actionDb.getAction("missingMethod");
    exception.expect(MissingMethodException.class);
    someAction.run(network, null);
}
项目:LiteGraph    文件:GremlinGroovyScriptEngine.java   
private Object invokeImpl(final Object thiz, final String name, final Object args[]) throws ScriptException, NoSuchMethodException {
    if (name == null) {
        throw new NullPointerException("Method name can not be null");
    }
    try {
        if (thiz != null) {
            return InvokerHelper.invokeMethod(thiz, name, args);
        }
    } catch (MissingMethodException mme) {
        throw new NoSuchMethodException(mme.getMessage());
    } catch (Exception e) {
        throw new ScriptException(e);
    }
    return callGlobal(name, args);
}
项目:LiteGraph    文件:GremlinGroovyScriptEngine.java   
private Object callGlobal(final String name, final Object args[], final ScriptContext ctx) {
    final Closure closure = globalClosures.get(name);
    if (closure != null) {
        return closure.call(args);
    }

    final Object value = ctx.getAttribute(name);
    if (value instanceof Closure) {
        return ((Closure) value).call(args);
    } else {
        throw new MissingMethodException(name, getClass(), args);
    }
}
项目:VoltDB    文件:DelegatingScript.java   
@Override
public Object invokeMethod(String name, Object args) {
    try {
        return metaClass.invokeMethod(delegate,name,args);
    } catch (MissingMethodException mme) {
        return super.invokeMethod(name, args);
    }
}
项目:groovy    文件:GroovyScriptEngineImpl.java   
private Object callGlobal(String name, Object[] args, ScriptContext ctx) {
    Closure<?> closure = globalClosures.get(name);
    if (closure != null) {
        return closure.call(args);
    } else {
        // Look for closure valued variable in the 
        // given ScriptContext. If available, call it.
        Object value = ctx.getAttribute(name);
        if (value instanceof Closure) {
            return ((Closure) value).call(args);
        } // else fall thru..
    }
    throw new MissingMethodException(name, getClass(), args);
}
项目:groovy    文件:ScriptBytecodeAdapter.java   
public static Object invokeMethodOnCurrentN(Class senderClass, GroovyObject receiver, String messageName, Object[] messageArguments) throws Throwable {
    Object result = null;
    boolean intercepting = receiver instanceof GroovyInterceptable;
    try {
        try {
            // if it's a pure interceptable object (even intercepting toString(), clone(), ...)
            if (intercepting) {
                result = receiver.invokeMethod(messageName, messageArguments);
            }
            //else if there's a statically typed method or a GDK method
            else {
                result = receiver.getMetaClass().invokeMethod(senderClass, receiver, messageName, messageArguments, false, true);
            }
        } catch (MissingMethodException e) {
            if (e instanceof MissingMethodExecutionFailed) {
                throw (MissingMethodException)e.getCause();
            } else if (!intercepting && receiver.getClass() == e.getType() && e.getMethod().equals(messageName)) {
                // in case there's nothing else, invoke the object's own invokeMethod()
                result = receiver.invokeMethod(messageName, messageArguments);
            } else {
                throw e;
            }
        }
    } catch (GroovyRuntimeException gre) {
        throw unwrap(gre);
    }
    return result;
}
项目:groovy    文件:IndyGuardsFiltersAndSignatures.java   
/**
 * {@link GroovyObject#invokeMethod(String, Object)} path as fallback.
 * This method is called by the handle as exception handler in case the
 * selected method causes a MissingMethodExecutionFailed, where
 * we will just give through the exception, and a normal 
 * MissingMethodException where we call {@link GroovyObject#invokeMethod(String, Object)}
 * if receiver class, the type transported by the exception and the name
 * for the method stored in the exception and our current method name 
 * are equal.
 * Should those conditions not apply we just rethrow the exception.
 */
public static Object invokeGroovyObjectInvoker(MissingMethodException e, Object receiver, String name, Object[] args) {
    if (e instanceof MissingMethodExecutionFailed) {
        throw (MissingMethodException)e.getCause();
    } else if (receiver.getClass() == e.getType() && e.getMethod().equals(name)) {
        //TODO: we should consider calling this one directly for MetaClassImpl,
        //      then we save the new method selection

        // in case there's nothing else, invoke the object's own invokeMethod()
        return ((GroovyObject)receiver).invokeMethod(name, args);
    } else {
        throw e;
    }
}
项目:groovy    文件:DelegatingScript.java   
@Override
public Object invokeMethod(String name, Object args) {
    try {
        if (delegate instanceof GroovyObject) {
            return ((GroovyObject) delegate).invokeMethod(name, args);
        }
        return metaClass.invokeMethod(delegate, name, args);
    } catch (MissingMethodException mme) {
        return super.invokeMethod(name, args);
    }
}
项目:groovy    文件:Proxy.java   
public Object invokeMethod(String name, Object args) {
    try {
        return super.invokeMethod(name, args);
    }
    catch (MissingMethodException e) {
        return InvokerHelper.invokeMethod(adaptee, name, args);
    }
}
项目:Pushjet-Android    文件:DefaultArtifactHandler.java   
public Object methodMissing(String name, Object arg) {
    Object[] args = (Object[]) arg;
    Configuration configuration = configurationContainer.findByName(name);
    if (configuration == null) {
        throw new MissingMethodException(name, this.getClass(), args);
    }
    List<Object> normalizedArgs = GUtil.flatten(Arrays.asList(args), false);
    if (normalizedArgs.size() == 2 && normalizedArgs.get(1) instanceof Closure) {
        return pushArtifact(configuration, normalizedArgs.get(0), (Closure) normalizedArgs.get(1));
    }
    for (Object notation : args) {
        pushArtifact(configuration, notation, null);
    }
    return null;
}
项目:Pushjet-Android    文件:BeanDynamicObject.java   
public Object invokeMethod(final String name, final Object... arguments) throws MissingMethodException {
    try {
        return getMetaClass().invokeMethod(bean, name, arguments);
    } catch (InvokerInvocationException e) {
        if (e.getCause() instanceof RuntimeException) {
            throw (RuntimeException) e.getCause();
        }
        throw e;
    }
}
项目:Pushjet-Android    文件:BeanDynamicObject.java   
@Override
public Object invokeMethod(String name, Object... arguments) throws MissingMethodException {
    try {
        return groovyObject.invokeMethod(name, arguments);
    } catch (InvokerInvocationException e) {
        if (e.getCause() instanceof RuntimeException) {
            throw (RuntimeException) e.getCause();
        }
        throw e;
    }
}
项目:Pushjet-Android    文件:DefaultConvention.java   
public Object invokeMethod(String name, Object... args) {
    if (extensionsStorage.isConfigureExtensionMethod(name, args)) {
        return extensionsStorage.configureExtension(name, args);
    }
    for (Object object : plugins.values()) {
        BeanDynamicObject dynamicObject = new BeanDynamicObject(object);
        if (dynamicObject.hasMethod(name, args)) {
            return dynamicObject.invokeMethod(name, args);
        }
    }
    throw new MissingMethodException(name, Convention.class, args);
}
项目:Pushjet-Android    文件:BeanDynamicObject.java   
public Object invokeMethod(final String name, final Object... arguments) throws MissingMethodException {
    try {
        return getMetaClass().invokeMethod(bean, name, arguments);
    } catch (InvokerInvocationException e) {
        if (e.getCause() instanceof RuntimeException) {
            throw (RuntimeException) e.getCause();
        }
        throw e;
    }
}
项目:Pushjet-Android    文件:BeanDynamicObject.java   
@Override
public Object invokeMethod(String name, Object... arguments) throws MissingMethodException {
    try {
        return groovyObject.invokeMethod(name, arguments);
    } catch (InvokerInvocationException e) {
        if (e.getCause() instanceof RuntimeException) {
            throw (RuntimeException) e.getCause();
        }
        throw e;
    }
}
项目:Pushjet-Android    文件:DefaultConvention.java   
public Object invokeMethod(String name, Object... args) {
    if (extensionsStorage.isConfigureExtensionMethod(name, args)) {
        return extensionsStorage.configureExtension(name, args);
    }
    for (Object object : plugins.values()) {
        BeanDynamicObject dynamicObject = new BeanDynamicObject(object);
        if (dynamicObject.hasMethod(name, args)) {
            return dynamicObject.invokeMethod(name, args);
        }
    }
    throw new MissingMethodException(name, Convention.class, args);
}