Package org.codehaus.groovy.runtime.metaclass

Examples of org.codehaus.groovy.runtime.metaclass.NewInstanceMetaMethod.invoke()


        Method method = getClass().getMethod("dummyMethod", new Class[]{String.class, String.class});
        assertTrue("Should have found a method", method != null);

        NewInstanceMetaMethod metaMethod = createNewMetaMethod(method);

        Object answer = metaMethod.invoke("abc", new Object[]{"xyz"});
        assertEquals("def", answer);

        assertTrue("Should not appear as static method", !metaMethod.isStatic());
    }
View Full Code Here


        Method method = DefaultGroovyMethods.class.getMethod("plus", new Class[]{String.class, Object.class});
        assertTrue("Should have found a method", method != null);

        NewInstanceMetaMethod metaMethod = createNewMetaMethod(method);

        Object answer = metaMethod.invoke("abc", new Object[]{"123"});
        assertEquals("abc123", answer);

        System.out.println("Found: " + answer);
    }
View Full Code Here

        Method method = getClass().getMethod("dummyMethod", new Class[]{String.class, String.class});
        assertTrue("Should have found a method", method != null);

        NewInstanceMetaMethod metaMethod = createNewMetaMethod(method);

        Object answer = metaMethod.invoke("abc", new Object[]{"xyz"});
        assertEquals("def", answer);

        assertTrue("Should not appear as static method", !metaMethod.isStatic());
    }
View Full Code Here

        Method method = DefaultGroovyMethods.class.getMethod("plus", new Class[]{String.class, Object.class});
        assertTrue("Should have found a method", method != null);

        NewInstanceMetaMethod metaMethod = createNewMetaMethod(method);

        Object answer = metaMethod.invoke("abc", new Object[]{"123"});
        assertEquals("abc123", answer);

        System.out.println("Found: " + answer);
    }
View Full Code Here

        Method method = getClass().getMethod("dummyMethod", new Class[]{String.class, String.class});
        assertTrue("Should have found a method", method != null);

        NewInstanceMetaMethod metaMethod = createNewMetaMethod(method);

        Object answer = metaMethod.invoke("abc", new Object[]{"xyz"});
        assertEquals("def", answer);

        assertTrue("Should not appear as static method", !metaMethod.isStatic());
    }
View Full Code Here

        Method method = DefaultGroovyMethods.class.getMethod("plus", new Class[]{String.class, Object.class});
        assertTrue("Should have found a method", method != null);

        NewInstanceMetaMethod metaMethod = createNewMetaMethod(method);

        Object answer = metaMethod.invoke("abc", new Object[]{"123"});
        assertEquals("abc123", answer);

        System.out.println("Found: " + answer);
    }
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.