Package groovy.lang

Examples of groovy.lang.Closure.call()


    public int compare(Object object1, Object object2) {
        for (Iterator iter = closures.iterator(); iter.hasNext();) {
            Closure closure = (Closure) iter.next();
            Object value1 = closure.call(object1);
            Object value2 = closure.call(object2);

            if (value1 == value2) {
                continue;
            }
            if (value1 == null) {
View Full Code Here


            this.prefix = "";

            if (tagMap.containsKey(name)) {
                return ((Closure) tagMap.get(name)).call(new Object[]{this, this.pendingNamespaces, this.namespaces, this.namespaceSpecificTags, prefix, attrs, body, this.out});
            } else {
                return defaultTagClosure.call(new Object[]{name, this, this.pendingNamespaces, this.namespaces, this.namespaceSpecificTags, prefix, attrs, body, this.out});
            }
        }

        /* (non-Javadoc)
         * @see groovy.lang.GroovyObject#getProperty(java.lang.String)
View Full Code Here

                                          public void build(final GroovyObject builder, final Map namespaceMap, final Map namespaceTagHints) {
                                              final Closure c = (Closure)replacementClosure.clone();
                                             
                                                  Node.this.replacementNodeStack.pop(); // disable the replacement whilst the closure is being executed
                                                  c.setDelegate(builder);
                                                  c.call(new Object[]{result});
                                                  Node.this.replacementNodeStack.push(this);
                                              }
                                          });
  }
 
View Full Code Here

          this.children.add(new ReplacementNode() {
                              public void build(final GroovyObject builder, final Map namespaceMap, final Map namespaceTagHints) {
                                  final Closure c = (Closure)((Closure)newValue).clone();
                                 
                                      c.setDelegate(builder);
                                      c.call(new Object[]{result});
                                  }
                              });
      } else {
          this.children.add(newValue);
      }
View Full Code Here

            Object oldCurrent = current;
            current = node;

            // lets register the builder as the delegate
            setClosureDelegate(closure, node);
            closure.call();

            current = oldCurrent;
        }

        proxyBuilder.nodeCompleted(current, node);
View Full Code Here

  }

  public Object invoke(Object object, Object[] arguments) {
    Closure cloned = (Closure) callable.clone();
    cloned.setDelegate(object);
    return cloned.call(arguments);
  }

    public int getModifiers() {
        return Modifier.PUBLIC | Modifier.STATIC;
    }
View Full Code Here

                        Vector arguments) throws BSFException {
        Object object = eval(source, lineNo, columnNo, funcBody);
        if (object instanceof Closure) {
            // lets call the function
            Closure closure = (Closure) object;
            return closure.call(arguments.toArray());
        }
        return object;
    }

    /**
 
View Full Code Here

   
    public Object invokeCustom(Object proxy, Method method, Object[] args)
    throws Throwable {
        Map m = (Map) getDelegate();
        Closure cl = (Closure) m.get(method.getName());
        return cl.call(args);
    }
   
    public String toString() {
        return DefaultGroovyMethods.toString((Map) getDelegate());
    }
View Full Code Here

            if (methods != null) {
                closure = (Closure) methods.get(name);
            }
        }
        if (closure != null) {
            closure.call(params);
        }
        /*
        else {
            throw DoesNotUnderstandException();
        }
View Full Code Here

  public Object invoke(final Object object, final Object[] arguments) {
    Closure cloned = (Closure) callable.clone();
    cloned.setDelegate(object);

    return cloned.call(arguments);
  }

  /**
     * Retrieves the closure that is invoked by this MetaMethod
     *
 
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.