Coverage Report - org.mule.config.spring.parsers.generic.OrphanDefinitionParser
 
Classes in this File Line Coverage Branch Coverage Complexity
OrphanDefinitionParser
0%
0/16
0%
0/2
1.25
 
 1  
 /*
 2  
  * $Id: OrphanDefinitionParser.java 10256 2008-01-08 15:20:25Z dfeist $
 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.config.spring.parsers.generic;
 11  
 
 12  
 import org.mule.config.spring.parsers.AbstractMuleBeanDefinitionParser;
 13  
 
 14  
 import org.w3c.dom.Element;
 15  
 
 16  
 /**
 17  
  * Contructs a single, standalone bean from an element - it is not injected into any other object.
 18  
  * This parser can be configured to automatically set the class of the object, the init and destroy methods
 19  
  * and whether this object is a singleton.
 20  
  *
 21  
  * <p>Typically, you should use {@link MuleOrphanDefinitionParser}
 22  
  * instead of this class, since these elements occur in the <mule> top level element.</p>
 23  
  */
 24  
 public class OrphanDefinitionParser extends AbstractMuleBeanDefinitionParser
 25  
 {
 26  
 
 27  0
     private Class beanClass = null;
 28  0
     private boolean dynamicClass = false;
 29  
 
 30  
     /**
 31  
      * This constructor assumes that the class name will be explicitly specified as an attribute on the element.
 32  
      */
 33  
     public OrphanDefinitionParser(boolean singleton)
 34  0
     {
 35  0
         this.singleton = singleton;
 36  0
         dynamicClass = true;
 37  0
     }
 38  
 
 39  
     public OrphanDefinitionParser(Class beanClass, boolean singleton)
 40  0
     {
 41  0
         this.beanClass = beanClass;
 42  0
         this.singleton = singleton;
 43  0
     }
 44  
 
 45  
     // @Override
 46  
     protected void preProcess(Element element)
 47  
     {
 48  0
         super.preProcess(element);
 49  
         // top level beans need an ID element
 50  0
         AutoIdUtils.ensureUniqueId(element, "bean");
 51  0
         if (dynamicClass)
 52  
         {
 53  0
             beanClass = null;
 54  
         }
 55  0
     }
 56  
 
 57  
     // @Override
 58  
     protected Class getBeanClass(Element element)
 59  
     {
 60  0
         return beanClass;
 61  
     }
 62  
 
 63  
 }