Package groovy.lang

Examples of groovy.lang.Closure.call()


                throw new IllegalArgumentException(
                        "No encoder found for request content type " + getRequestContentType() );

            HttpEntity entity = encoder.getMaximumNumberOfParameters() == 2
                    ? (HttpEntity)encoder.call( new Object[] { body, this.getRequestContentType() } )
                    : (HttpEntity)encoder.call( body );

            ((HttpEntityEnclosingRequest)this.request).setEntity( entity );
        }

        /**
 
View Full Code Here


                return "";
            }
        };
        Closure tag = (Closure)tagLibProp;
        if (tag.getParameterTypes().length == 1) {
            tag.call(new Object[]{ attributes });
            if (body != null) {
                body.call();
            }
        }
        if (tag.getParameterTypes().length == 2) {
View Full Code Here

            if (body != null) {
                body.call();
            }
        }
        if (tag.getParameterTypes().length == 2) {
            tag.call(new Object[] { attributes, body });
        }

        Collections.reverse(invocationArgs);
        setCurrentArgument();
        return EVAL_BODY_BUFFERED;
View Full Code Here

                            Closure callable = (Closure) args[0];
                            if (delegate != null) {
                                callable.setDelegate(delegate);
                            }
                            callable.call();

                            if (binding != null) {
                                mappingInfo.setController(variables.get(GrailsControllerClass.CONTROLLER));
                                mappingInfo.setAction(variables.get(GrailsControllerClass.ACTION));
                                mappingInfo.setView(variables.get(GrailsControllerClass.VIEW));
View Full Code Here

                        Closure callable = (Closure) args[0];
                        callable.setDelegate(builder);
                        for (ConstrainedProperty constrainedProperty : currentConstraints) {
                            builder.getConstrainedProperties().put(constrainedProperty.getPropertyName(), constrainedProperty);
                        }
                        callable.call();
                    }
                    return builder.getConstrainedProperties();
                } else {
                    return super.invokeMethod(mappedURI, arg);
                }
View Full Code Here

                Closure tag = (Closure) ((Closure) tagLibProp).clone();
                Object bodyResult;

                switch (tag.getParameterTypes().length) {
                    case 1:
                        bodyResult = tag.call(new Object[]{attrs});
                        if (actualBody != null && actualBody != EMPTY_BODY_CLOSURE) {
                            Object bodyResult2 = actualBody.call();
                            if (bodyResult2 != null) {
                                if (actualBody instanceof ConstantClosure) {
                                    outputStack.getStaticWriter().print(bodyResult2);
View Full Code Here

                            }
                        }

                        break;
                    case 2:
                        bodyResult = tag.call(new Object[]{attrs, actualBody});
                        break;
                    default:
                        throw new GrailsTagException("Tag [" + tagName +
                                "] does not specify expected number of params in tag library [" +
                                tagLib.getClass().getName() + "]");
View Full Code Here

        if (value instanceof Closure) {
            Closure callable = (Closure) value;
            final Closure cloned = (Closure) callable.clone();
            cloned.setDelegate(webRequest);
            cloned.setResolveStrategy(Closure.DELEGATE_FIRST);
            Object result = cloned.call();
            name = result != null ? result.toString() : null;
        }
        else if (value instanceof Map) {
            Map httpMethods = (Map) value;
            name = (String) httpMethods.get(webRequest.getCurrentRequest().getMethod());
View Full Code Here

               
                if (body == null) {
                    staticOut.append("/>");
                } else {
                    staticOut.append('>');
                    Object bodyOutput = body.call();
                    if (bodyOutput != null) staticOut.print(bodyOutput);
                    staticOut.append("</").append(tagNamespace).append(':').append(tagName).append('>');
                }

            }
View Full Code Here

                    constructorArgs = resolveConstructorArguments(args, 0, index);
                }
            }
            currentBeanConfig =  constructorArgs == null ? springConfig.createSingletonBean(type) : springConfig.createSingletonBean(type, constructorArgs);
            if (callable != null) {
                callable.call(new Object[]{currentBeanConfig});
            }
            return currentBeanConfig.getBeanDefinition();

        }
        finally {
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.