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  
  * $Id: ObjectFactoryDefinitionParser.java 20297 2010-11-22 18:49:18Z aperepel $
 3  
  * --------------------------------------------------------------------------------------
 4  
  * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.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  
 
 11  
 package org.mule.config.spring.parsers.specific;
 12  
 
 13  
 import org.mule.config.spring.parsers.AbstractChildDefinitionParser;
 14  
 import org.mule.config.spring.parsers.AbstractMuleBeanDefinitionParser;
 15  
 import org.mule.object.AbstractObjectFactory;
 16  
 
 17  
 import org.springframework.beans.factory.config.BeanDefinition;
 18  
 import org.w3c.dom.Element;
 19  
 
 20  
 public class ObjectFactoryDefinitionParser extends AbstractChildDefinitionParser
 21  
 {
 22  
     
 23  0
     protected Class beanClass = null;
 24  0
     protected String setterMethod = null;
 25  
 
 26  
     public ObjectFactoryDefinitionParser(Class beanClass, String setterMethod)
 27  
     {
 28  0
         this(beanClass);
 29  0
         this.setterMethod = setterMethod;
 30  0
     }                                                             
 31  
     
 32  
     public ObjectFactoryDefinitionParser(Class beanClass)
 33  
     {
 34  0
         super();
 35  0
         this.beanClass = beanClass;
 36  0
         setAllowClassAttribute(false);
 37  0
         addAlias(AbstractMuleBeanDefinitionParser.ATTRIBUTE_CLASS, AbstractObjectFactory.ATTRIBUTE_OBJECT_CLASS_NAME);
 38  0
         addAlias(AbstractMuleBeanDefinitionParser.ATTRIBUTE_REF, "factoryBean");
 39  0
     }
 40  
 
 41  
     public String getPropertyName(Element element)
 42  
     {
 43  0
         if (setterMethod != null)
 44  
         {
 45  0
             return setterMethod;
 46  
         }
 47  
         else
 48  
         {
 49  0
             BeanDefinition parent = getParentBeanDefinition(element);
 50  0
             String setter = (String) parent.getAttribute(ObjectFactoryWrapper.OBJECT_FACTORY_SETTER);
 51  0
             return setter;
 52  
         }
 53  
     }
 54  
 
 55  
     protected Class getBeanClass(Element element)
 56  
     {
 57  0
         return beanClass;
 58  
     }                                                                 
 59  
 }