Coverage Report - org.mule.config.spring.parsers.specific.ObjectFactoryDefinitionParser
 
Classes in this File Line Coverage Branch Coverage Complexity
ObjectFactoryDefinitionParser
0%
0/17
0%
0/2
1.5
 
 1  
 /*
 2  
  * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
 3  
  * The software in this package is published under the terms of the CPAL v1.0
 4  
  * license, a copy of which has been included with this distribution in the
 5  
  * LICENSE.txt file.
 6  
  */
 7  
 package org.mule.config.spring.parsers.specific;
 8  
 
 9  
 import org.mule.config.spring.parsers.AbstractChildDefinitionParser;
 10  
 import org.mule.config.spring.parsers.AbstractMuleBeanDefinitionParser;
 11  
 import org.mule.object.AbstractObjectFactory;
 12  
 
 13  
 import org.springframework.beans.factory.config.BeanDefinition;
 14  
 import org.w3c.dom.Element;
 15  
 
 16  
 public class ObjectFactoryDefinitionParser extends AbstractChildDefinitionParser
 17  
 {
 18  
     
 19  0
     protected Class beanClass = null;
 20  0
     protected String setterMethod = null;
 21  
 
 22  
     public ObjectFactoryDefinitionParser(Class beanClass, String setterMethod)
 23  
     {
 24  0
         this(beanClass);
 25  0
         this.setterMethod = setterMethod;
 26  0
     }                                                             
 27  
     
 28  
     public ObjectFactoryDefinitionParser(Class beanClass)
 29  
     {
 30  0
         super();
 31  0
         this.beanClass = beanClass;
 32  0
         setAllowClassAttribute(false);
 33  0
         addAlias(AbstractMuleBeanDefinitionParser.ATTRIBUTE_CLASS, AbstractObjectFactory.ATTRIBUTE_OBJECT_CLASS_NAME);
 34  0
         addAlias(AbstractMuleBeanDefinitionParser.ATTRIBUTE_REF, "factoryBean");
 35  0
     }
 36  
 
 37  
     public String getPropertyName(Element element)
 38  
     {
 39  0
         if (setterMethod != null)
 40  
         {
 41  0
             return setterMethod;
 42  
         }
 43  
         else
 44  
         {
 45  0
             BeanDefinition parent = getParentBeanDefinition(element);
 46  0
             String setter = (String) parent.getAttribute(ObjectFactoryWrapper.OBJECT_FACTORY_SETTER);
 47  0
             return setter;
 48  
         }
 49  
     }
 50  
 
 51  
     protected Class getBeanClass(Element element)
 52  
     {
 53  0
         return beanClass;
 54  
     }                                                                 
 55  
 }