001    package railo.transformer.cfml.attributes.impl;
002    
003    import railo.transformer.bytecode.expression.Expression;
004    import railo.transformer.bytecode.literal.LitBoolean;
005    import railo.transformer.bytecode.statement.tag.Attribute;
006    import railo.transformer.bytecode.statement.tag.Tag;
007    import railo.transformer.cfml.attributes.AttributeEvaluator;
008    import railo.transformer.cfml.attributes.AttributeEvaluatorException;
009    import railo.transformer.library.tag.TagLibTag;
010    
011    /**
012     * Attribute Evaluator for the tag Function
013     */
014    public final class Component implements AttributeEvaluator {
015    
016        /**
017         * @see railo.transformer.cfml.attributes.AttributeEvaluator#evaluate(railo.transformer.library.tag.TagLibTag, org.w3c.dom.Element)
018         */
019        public TagLibTag evaluate( TagLibTag tagLibTag, Tag tag) throws AttributeEvaluatorException {
020                    tagLibTag.setParseBody(false);
021                    Attribute attr = tag.getAttribute("output");
022                    if(attr!=null) {
023                            Expression expr = attr.getValue();
024                            
025                            if(!(expr instanceof LitBoolean))
026                                    throw new AttributeEvaluatorException("Attribute output of the Tag Component, must be a static boolean value (true or false)");
027                            if(((LitBoolean)expr).getBooleanValue())
028                                    tagLibTag.setParseBody(true);
029                    }
030            return tagLibTag;
031        }
032    }