Package groovy.lang

Examples of groovy.lang.GroovyObjectSupport


        }
    }

    public void testShouldSetPropertiesWithGPath() throws IntrospectionException {
        Root root = new Root();
        GroovyObjectSupport rootSupport = new Reference(root);

        // Both Groovy and OGNL can do this
        NodeOne nodeOne = new NodeOne();
        rootSupport.setProperty("nodeOne", nodeOne);
        assertSame(nodeOne, root.getNodeOne());

        // OGNL can do this, but Groovy can't :-(
        NodeTwo nodeTwo = new NodeTwo();
        rootSupport.setProperty("nodeOne.nodeTwo", nodeTwo);
        assertSame(nodeTwo, nodeOne.getNodeTwo());
    }
View Full Code Here


    private static void assertRoundTrip(Step step, String expected) throws Exception {
        assertEquals(expected, Snippetizer.object2Groovy(step));
        GroovyShell shell = new GroovyShell(r.jenkins.getPluginManager().uberClassLoader);
        final StepDescriptor desc = step.getDescriptor();
        shell.setVariable("steps", new GroovyObjectSupport() {
            @Override public Object invokeMethod(String name, Object args) {
                if (name.equals(desc.getFunctionName())) {
                    try {
                        return desc.newInstance(DSL.parseArgs(desc, args).namedArgs);
                    } catch (RuntimeException x) {
View Full Code Here

                .build();

        ant.withClasspath(combinedClasspath).execute(new Closure<Object>(this, this) {
            @SuppressWarnings("UnusedDeclaration")
            public Object doCall(Object it) {
                final GroovyObjectSupport antBuilder = (GroovyObjectSupport) it;

                antBuilder.invokeMethod("taskdef", ImmutableMap.of(
                        "name", "groovydoc",
                        "classname", "org.codehaus.groovy.ant.Groovydoc"
                ));

                antBuilder.invokeMethod("groovydoc", new Object[]{args, new Closure<Object>(this, this) {
                    public Object doCall(Object ignore) {
                        for (Groovydoc.Link link : links) {
                            antBuilder.invokeMethod("link", new Object[]{
                                    ImmutableMap.of(
                                            "packages", Joiner.on(",").join(link.getPackages()),
                                            "href", link.getUrl()
                                    )
                            });
View Full Code Here

    }

    // Configure the command with the closure
    if (closure != null) {
      final HashMap<String, Object> closureOptions = new HashMap<String, Object>();
      GroovyObjectSupport delegate = new GroovyObjectSupport() {
        @Override
        public void setProperty(String property, Object newValue) {
          closureOptions.put(property, newValue);
        }
      };
View Full Code Here

TOP

Related Classes of groovy.lang.GroovyObjectSupport

Copyright © 2018 www.massapicom. 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.