Coverage Report - org.mule.module.ognl.config.OGNLNamespaceHandler
 
Classes in this File Line Coverage Branch Coverage Complexity
OGNLNamespaceHandler
100%
5/5
N/A
1
OGNLNamespaceHandler$1
N/A
N/A
1
OGNLNamespaceHandler$CDATABeanDefinitionParser
100%
5/5
N/A
1
 
 1  
 /*
 2  
  * $Id: OGNLNamespaceHandler.java 11195 2008-03-06 04:13:01Z tcarlson $
 3  
  * --------------------------------------------------------------------------------------
 4  
  * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
 5  
  *
 6  
  * The software in this package is published under the terms of the CPAL v1.0
 7  
  * license, a copy of which has been included with this distribution in the
 8  
  * LICENSE.txt file.
 9  
  */
 10  
 package org.mule.module.ognl.config;
 11  
 
 12  
 import org.mule.config.spring.parsers.assembly.BeanAssembler;
 13  
 import org.mule.config.spring.parsers.generic.ChildDefinitionParser;
 14  
 import org.mule.module.ognl.filters.OGNLFilter;
 15  
 
 16  
 import org.springframework.beans.factory.xml.NamespaceHandlerSupport;
 17  
 import org.springframework.beans.factory.xml.ParserContext;
 18  
 import org.w3c.dom.Element;
 19  
 
 20  
 /**
 21  
  * Registers Bean Definition Parsers for the "ognl" namespace.
 22  
  */
 23  12
 public class OGNLNamespaceHandler extends NamespaceHandlerSupport
 24  
 {
 25  
 
 26  
     public void init()
 27  
     {
 28  12
         registerBeanDefinitionParser("filter", new ChildDefinitionParser("filter", OGNLFilter.class));
 29  12
         registerBeanDefinitionParser("expression", new CDATABeanDefinitionParser("expression", String.class));
 30  12
     }
 31  
 
 32  12
     private static class CDATABeanDefinitionParser extends
 33  
                                                    ChildDefinitionParser
 34  
     {
 35  
         private CDATABeanDefinitionParser(String setterMethod, Class clazz)
 36  
         {
 37  12
             super(setterMethod, clazz);
 38  12
         }
 39  
 
 40  
         protected void postProcess(ParserContext context, BeanAssembler assembler, Element element)
 41  
         {
 42  12
             assembler.extendTarget(setterMethod, element.getFirstChild().getNodeValue(), false);
 43  12
         }
 44  
     }
 45  
 }