Package org.apache.commons.jelly.expression

Examples of org.apache.commons.jelly.expression.Expression


                    // now iterate through through the expressions
                    int size = list.getLength();
                    for (int i = 0; i < size; i++) {
                        String attributeName = list.getLocalName(i);
                        String attributeValue = list.getValue(i);
                        Expression expression =
                            taglib.createExpression(
                                getExpressionFactory(),
                                localName,
                                attributeName,
                                attributeValue);
View Full Code Here


            // now iterate through through the expressions
            int size = list.getLength();
            for (int i = 0; i < size; i++) {
                String attributeName = list.getLocalName(i);
                String attributeValue = list.getValue(i);
                Expression expression = CompositeExpression.parse(
                    attributeValue, getExpressionFactory()
                );
                script.addAttribute(attributeName, expression);
            }
            return script;
View Full Code Here

    /**
     * Adds the text to the current script block parsing any embedded
     * expressions inot ExpressionScript objects.
     */
    protected void addTextScript(String text) throws Exception {
        Expression expression =
            CompositeExpression.parse(text, getExpressionFactory());

        addExpressionScript(script, expression);
    }
View Full Code Here

   
            // ### probably compiling this to 2 arrays might be quicker and smaller
            for (Iterator iter = attributes.entrySet().iterator(); iter.hasNext();) {
                Map.Entry entry = (Map.Entry) iter.next();
                String name = (String) entry.getKey();
                Expression expression = (Expression) entry.getValue();
   
                Object value = expression.evaluate(context);
                dynaTag.setAttribute(name, value);
            }
       
            tag.doTag(output);
        }
View Full Code Here

       
                // ### probably compiling this to 2 arrays might be quicker and smaller
                for (Iterator iter = attributes.entrySet().iterator(); iter.hasNext();) {
                    Map.Entry entry = (Map.Entry) iter.next();
                    String name = (String) entry.getKey();
                    Expression expression = (Expression) entry.getValue();
       
                    Object value = expression.evaluate(context);
                    dynaTag.setAttribute(name, value);
                }
            }
            else {
                // treat the tag as a bean
                DynaBean dynaBean = new ConvertingWrapDynaBean( tag );
                for (Iterator iter = attributes.entrySet().iterator(); iter.hasNext();) {
                    Map.Entry entry = (Map.Entry) iter.next();
                    String name = (String) entry.getKey();
                    Expression expression = (Expression) entry.getValue();
       
                    Object value = expression.evaluate(context);
                    dynaBean.set(name, value);
                }
            }
       
            tag.doTag(output);
View Full Code Here

                if ( attribute.isRequired() ) {
                    throw new MissingAttributeException(name);
                }
                // lets get the default value
                Object value = null;
                Expression expression = attribute.getDefaultValue();
                if ( expression != null ) {
                    value = expression.evaluate(context);
                }
               
                // only set non-null values?
                if ( value != null ) {
                    super.setAttribute(name, value);
View Full Code Here

        tag.setContext(context);
       
        // initialize all the properties of the tag before its used
        // if there is a problem abort this tag
        for (int i = 0, size = expressions.length; i < size; i++) {
            Expression expression = expressions[i];
            Method method = methods[i];
            Class type = types[i];
           
            // some types are Expression objects so let the tag
            // evaluate them
            Object value = null;
            if (type.isAssignableFrom(Expression.class) && !type.isAssignableFrom(Object.class)) {
                value = expression;
            }
            else {
                value = expression.evaluate(context);
            }
            // convert value to correct type
            if (value != null) {
                value = convertType(value, type);
            }           
View Full Code Here

        Set attributeSet = new HashSet();
        if (descriptors != null) {
            for (int i = 0, size = descriptors.length; i < size; i++) {
                PropertyDescriptor descriptor = descriptors[i];
                String name = descriptor.getName();
                Expression expression = (Expression) attributes.get(name);
                if (expression != null) {
                    attributeSet.add( name );
                    Method writeMethod = descriptor.getWriteMethod();
                    if (writeMethod != null) {
                        Class type = descriptor.getPropertyType();
View Full Code Here

                if ( attribute.isRequired() ) {
                    throw new MissingAttributeException(name);
                }
                // lets get the default value
                Object value = null;
                Expression expression = attribute.getDefaultValue();
                if ( expression != null ) {
                    value = expression.evaluate(context);
                }
               
                // only set non-null values?
                if ( value != null ) {
                    super.setAttribute(name, value);
View Full Code Here

            // ### probably compiling this to 2 arrays might be quicker and smaller
            for (Iterator iter = attributes.entrySet().iterator(); iter.hasNext();) {
                Map.Entry entry = (Map.Entry) iter.next();
                String name = (String) entry.getKey();
                Expression expression = (Expression) entry.getValue();

                Object value = null;

                if ( Expression.class.isAssignableFrom( dynaTag.getAttributeType(name) ) ) {
                    value = expression;
                } else {
                    value = expression.evaluate(context);
                }

                dynaTag.setAttribute(name, value);
            }
View Full Code Here

TOP

Related Classes of org.apache.commons.jelly.expression.Expression

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.