public Object invokeMethod(String name, Object args) { return this.metaClass.invokeMethod(this, name, args); }
public Object invokeMethod(String name, Object args) { return this.metaClass.invokeMethod(this, name, args); }
public Object invokeMethod(String name, Object args) { return this.metaClass.invokeMethod(this, name, args); }
public Object invokeMethod(String name, Object args) { return this.metaClass.invokeMethod(this, name, args); }
public Object invokeMethod(String name, Object args) { return this.metaClass.invokeMethod(this, name, args); }
public Object invokeMethod(String name, Object args) { return this.metaClass.invokeMethod(this, name, args); }
public Object invokeMethod(String name, Object args) { return this.metaClass.invokeMethod(this, name, args); }
/** * GroovyObject support method */ @Override public Object invokeMethod(String name, Object args) { return this.metaClass.invokeMethod(this, name, args); } /*----------------------<< GroovyObject methods---------------------------*/
public Object invokeMethod(String name, Object arguments) { return metaClass.invokeMethod(this, name, arguments); } }
private static Object invokeStaticClosureProperty(Object[] originalArguments, Object prop) { Closure closure = (Closure) prop; MetaClass delegateMetaClass = closure.getMetaClass(); return delegateMetaClass.invokeMethod(closure.getClass(), closure, CLOSURE_DO_CALL_METHOD, originalArguments, false, false); }
public Object invokeMethod(final String name, final Object args) { if ("x".equals(name)) { return "dynamic method"; } else { return this.metaClass.invokeMethod(this, name, args); } }
public Object invokeMethod(Object object, String methodName, Object arguments) { final Object owner = getOwner(); final MetaClass ownerMetaClass = getOwnerMetaClass(owner); return ownerMetaClass.invokeMethod(owner, methodName, arguments); }
return mc.invokeMethod(getRegistry(), name, args);
/** * This method is invoked by Groovy when a method that's not defined in Java is invoked. * We use that as a syntax for bean definition. */ public Object methodMissing(String name, Object arg) { Object[] args = (Object[])arg; if(args.length == 0) throw new MissingMethodException(name,getClass(),args); if(args[0] instanceof Closure) { // abstract bean definition return invokeBeanDefiningMethod(name, args); } else if(args[0] instanceof Class || args[0] instanceof RuntimeBeanReference || args[0] instanceof Map) { return invokeBeanDefiningMethod(name, args); } else if (args.length > 1 && args[args.length -1] instanceof Closure) { return invokeBeanDefiningMethod(name, args); } WebApplicationContext ctx = springConfig.getUnrefreshedApplicationContext(); MetaClass mc = DefaultGroovyMethods.getMetaClass(ctx); if(!mc.respondsTo(ctx, name, args).isEmpty()){ return mc.invokeMethod(ctx,name, args); } return this; }
public void testMetaClass() { Class foo = String[].class; System.out.println(foo + " name: " + foo.getName()); MetaClass metaClass = InvokerHelper.getMetaClass(this); assertTrue("got metaclass", metaClass != null); metaClass.invokeMethod(this, "doSomething", new Object[0]); }
public Object call(Object receiver, Object[] args) throws Throwable { if (receiver != null && info.hasPerInstanceMetaClasses()) { try { return InvokerHelper.getMetaClass(receiver).invokeMethod(receiver, name, args); } catch (GroovyRuntimeException gre) { throw ScriptBytecodeAdapter.unwrap(gre); } } else { return CallSiteArray.defaultCall(this, receiver, args); } } }
public void testObject() { Object value = new Object(); MetaClass metaClass = InvokerHelper.getMetaClass(value); assertTrue("got metaclass", metaClass != null); metaClass.invokeMethod(value, "toString", new Object[0]); }
public void testArray() { String[] value = new String[]{"hello"}; MetaClass metaClass = InvokerHelper.getMetaClass(value); assertTrue("got metaclass", metaClass != null); metaClass.invokeMethod(value, "toString", new Object[0]); }
@Override public Object respond(IMockInvocation invocation) { Object instance = invocation.getMockObject().getInstance(); Object[] arguments = invocation.getArguments().toArray(); if (invocation.getMethod().isStatic()) { if ("<init>".equals(invocation.getMethod().getName())) { return metaClass.invokeConstructor(arguments); } return metaClass.invokeStaticMethod(instance, invocation.getMethod().getName(), arguments); } return metaClass.invokeMethod(instance, invocation.getMethod().getName(), arguments); } }
public void testString() { String value = "hello"; MetaClass metaClass = InvokerHelper.getMetaClass(value); assertTrue("got metaclass", metaClass != null); Object answer = metaClass.invokeMethod(value, "toString", new Object[0]); assertEquals("hello", answer); }