Package groovy.lang

Examples of groovy.lang.MetaClass.invokeMethod()


      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 WebApplicationContext createApplicationContext() {
View Full Code Here


   * @see ObjectFactoryInterceptor#isPassParentToConstructor()
   */
  public void associate(GroovyBuilder builder, ObjectFactoryInterceptor ofi, Object child, Object parent) {
    if (parent != null) {
      MetaClass pmc = InvokerHelper.getMetaClass(child.getClass());
      pmc.invokeMethod(parent, "addChild", new Object[] { parent });
    }
   
    MetaClass cmc = InvokerHelper.getMetaClass(child.getClass());
    cmc.invokeMethod(child, "setParent", new Object[] { parent });
  }
View Full Code Here

      MetaClass pmc = InvokerHelper.getMetaClass(child.getClass());
      pmc.invokeMethod(parent, "addChild", new Object[] { parent });
    }
   
    MetaClass cmc = InvokerHelper.getMetaClass(child.getClass());
    cmc.invokeMethod(child, "setParent", new Object[] { parent });
  }

}
View Full Code Here

   * @see ObjectFactoryInterceptor#isPassParentToConstructor()
   */
  public void associate(GroovyBuilder builder, ObjectFactoryInterceptor ofi, Object child, Object parent) {
    if (parent != null) {
      MetaClass pmc = InvokerHelper.getMetaClass(child.getClass());
      pmc.invokeMethod(parent, "addChild", new Object[] { parent });
    }
   
    MetaClass cmc = InvokerHelper.getMetaClass(child.getClass());
    cmc.invokeMethod(child, "setParent", new Object[] { parent });
  }
View Full Code Here

      MetaClass pmc = InvokerHelper.getMetaClass(child.getClass());
      pmc.invokeMethod(parent, "addChild", new Object[] { parent });
    }
   
    MetaClass cmc = InvokerHelper.getMetaClass(child.getClass());
    cmc.invokeMethod(child, "setParent", new Object[] { parent });
  }

}
View Full Code Here

        Class type = object.getClass();
        System.out.println("Type: " + type);

        // invoke via metaclass
        metaClass.invokeMethod(object, "main", null);

        // invoke directly
        object.invokeMethod("main", null);
    }
}
View Full Code Here

        Class type = object.getClass();
        System.out.println("Type: " + type);

        // invoke via metaclass
        metaClass.invokeMethod(object, "main", null);

        // invoke directly
        object.invokeMethod("main", null);
    }
}
View Full Code Here

    }

    private void removeBeanDefinition(BeanDefinitionRegistry registry, String beanName) {
        MetaClass mc = GroovySystem.getMetaClassRegistry().getMetaClass(registry.getClass());
        if (!mc.respondsTo(registry, "removeBeanDefinition").isEmpty()) {
            mc.invokeMethod(registry, "removeBeanDefinition", new Object[] { beanName });
        }
    }

    public BeanConfiguration addAbstractBean(String name) {
        BeanConfiguration bc = new DefaultBeanConfiguration(name);
View Full Code Here

     */
    public static Object invokeMethodIfExists(Object instance, String methodName, Object[] args) {
        MetaClass metaClass = getMetaClass(instance);
        List<MetaMethod> methodList = metaClass.respondsTo(instance, methodName, args);
        if (methodList != null && !methodList.isEmpty()) {
            return metaClass.invokeMethod(instance, methodName, args);
        }
        return null;
    }
}
View Full Code Here

        }

        ApplicationContext ctx = springConfig.getUnrefreshedApplicationContext();
        MetaClass mc = DefaultGroovyMethods.getMetaClass(ctx);
        if (!mc.respondsTo(ctx, name, args).isEmpty()) {
            return mc.invokeMethod(ctx,name, args);
        }

        return this;
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.