Package groovy.lang

Examples of groovy.lang.GroovyObject.invokeMethod()


        assertThat(groovyObject.getMetaClass(), notNullValue());

        groovyObject.setProperty("prop", "value");
        assertThat(bean.getProp(), equalTo("value"));
        assertThat(groovyObject.getProperty("prop"), equalTo((Object) "value"));
        assertThat(groovyObject.invokeMethod("doStuff", new Object[]{"some value"}), equalTo((Object) "{some value}"));
    }

    @Test
    public void cachesGeneratedSubclass() {
        assertSame(generator.generate(Bean.class), generator.generate(Bean.class));
View Full Code Here


            final GroovyObject groovyObject = (GroovyObject)groovyClass.newInstance();

            this.copyProperties(
                this.stub,
                groovyObject);
            return groovyObject.invokeMethod(
                methodName,
                args);
        }
        catch (final Throwable throwable)
        {
View Full Code Here

    {
      ClassLoader parent = WrapperGroovyMain.class.getClassLoader();
      GroovyClassLoader loader = new GroovyClassLoader(parent);
      Class groovyClass = loader.parseClass(scriptFile);
      GroovyObject script = (GroovyObject) groovyClass.newInstance();
      script.invokeMethod("main", mainMethodArgs);
    }
    catch (Throwable e)
    {
      e.printStackTrace();
      exception = e;
View Full Code Here

  @SuppressWarnings("unchecked")
  protected Object getValue() {
    Object config = null;
    if (context.containsViewBean(configId)) {
      GroovyObject bean = (GroovyObject) context.getViewBean(configId);
      config = bean.invokeMethod("getComponentDefinition", null);
    } else {
      config = configService.getConfig(configId);
    }
    if (config instanceof Map) {
      return mapWrapperFactory.createWrapper(getScope(), getModelScope(), (Map<String, Object>) config);
View Full Code Here

  protected Object getValue() {
    Object config = null;
    Context context = Context.getCurrentContext();
    if (context.containsViewBean(extendedId)) {
      GroovyObject bean = (GroovyObject) context.getViewBean(extendedId);
      config = bean.invokeMethod("getComponentDefinition", null);
    } else {
      config = configService.getConfig(extendedId);
    }
    if (Map.class.isAssignableFrom(config.getClass())) {
      Map<String, Object> result = new LinkedHashMap<String, Object>();
View Full Code Here

*/
public class ConstructorTest extends TestSupport {

    public void testConstructor() throws Exception {
        GroovyObject object = compile("src/test/groovy/NewExpressionTest.groovy");
        object.invokeMethod("testNewInstance", null);
    }
}
View Full Code Here

*/
public class RunGroovyTest extends TestSupport {

    public void testArrayBug() throws Exception {
        GroovyObject object = compile("src/test/groovy/ToArrayBugTest.groovy");
        object.invokeMethod("testToArrayBug", null);
    }


    public void testPostfix() throws Exception {
        GroovyObject object = compile("src/test/groovy/PostfixTest.groovy");
View Full Code Here

    }


    public void testPostfix() throws Exception {
        GroovyObject object = compile("src/test/groovy/PostfixTest.groovy");
        object.invokeMethod("testIntegerPostfix", null);
    }

    public void testMap() throws Exception {
        GroovyObject object = compile("src/test/groovy/MapTest.groovy");
        object.invokeMethod("testMap", null);
View Full Code Here

        object.invokeMethod("testIntegerPostfix", null);
    }

    public void testMap() throws Exception {
        GroovyObject object = compile("src/test/groovy/MapTest.groovy");
        object.invokeMethod("testMap", null);
    }

    public void testClosure() throws Exception {
        GroovyObject object = compile("src/test/groovy/ClosureMethodTest.groovy");
        object.invokeMethod("testListCollect", null);
View Full Code Here

        object.invokeMethod("testMap", null);
    }

    public void testClosure() throws Exception {
        GroovyObject object = compile("src/test/groovy/ClosureMethodTest.groovy");
        object.invokeMethod("testListCollect", null);
    }

    public void testClosureWithDefaultParam() throws Exception {
        GroovyObject object = compile("src/test/groovy/ClosureWithDefaultParamTest.groovy");
        object.invokeMethod("methodWithDefaultParam", null);
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.