Coverage Report - org.mule.config.spring.parsers.collection.ChildListEntryDefinitionParser
 
Classes in this File Line Coverage Branch Coverage Complexity
ChildListEntryDefinitionParser
0%
0/15
0%
0/2
1.125
ChildListEntryDefinitionParser$ListEntry
0%
0/8
N/A
1.125
 
 1  
 /*
 2  
  * $Id: ChildListEntryDefinitionParser.java 19191 2010-08-25 21:05:23Z tcarlson $
 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.collection;
 12  
 
 13  
 import org.mule.config.spring.parsers.assembly.BeanAssembler;
 14  
 import org.mule.config.spring.parsers.generic.ChildDefinitionParser;
 15  
 import org.mule.config.spring.util.SpringXMLUtils;
 16  
 
 17  
 import org.springframework.beans.factory.support.BeanDefinitionBuilder;
 18  
 import org.springframework.beans.factory.xml.ParserContext;
 19  
 import org.w3c.dom.Element;
 20  
 
 21  
 
 22  
 /**
 23  
  * Process an element as a value that is appended to a list in the parent object (the
 24  
  * enclosing XML element).
 25  
  */
 26  
 public class ChildListEntryDefinitionParser extends ChildDefinitionParser
 27  
 {
 28  
 
 29  
     public static final String VALUE = "value";
 30  0
     private boolean fromText = true;
 31  
 
 32  
     /**
 33  
      * Takes value from enclosed text
 34  
      *
 35  
      * @param propertyName
 36  
      */
 37  
     public ChildListEntryDefinitionParser(String propertyName)
 38  
     {
 39  0
         super(propertyName, ListEntry.class);
 40  0
         setIgnoredDefault(true);
 41  0
     }
 42  
 
 43  
     /**
 44  
      * Takes value from attribute
 45  
      *
 46  
      * @param propertyName
 47  
      * @param attributeName
 48  
      */
 49  
     public ChildListEntryDefinitionParser(String propertyName, String attributeName)
 50  
     {
 51  0
         this(propertyName);
 52  0
         addAlias(attributeName, VALUE);
 53  0
         removeIgnored(attributeName);
 54  0
         fromText = false;
 55  0
     }
 56  
 
 57  
     protected void postProcess(ParserContext context, BeanAssembler assembler, Element element)
 58  
     {
 59  0
         if (fromText)
 60  
         {
 61  0
             assembler.extendBean(VALUE, SpringXMLUtils.getTextChild(element), false);
 62  
         }
 63  0
         super.postProcess(context, assembler, element);
 64  0
     }
 65  
 
 66  
     protected void parseChild(Element element, ParserContext parserContext, BeanDefinitionBuilder builder)
 67  
     {
 68  0
         super.parseChild(element, parserContext, builder);    //To change body of overridden methods use File | Settings | File Templates.
 69  0
     }
 70  
 
 71  
     public static class ListEntry
 72  
     {
 73  
 
 74  
         private Object value;
 75  
 
 76  
         public ListEntry()
 77  
         {
 78  0
             super();
 79  0
         }
 80  
         
 81  
         public ListEntry(Object proxied)
 82  
         {
 83  0
             this();
 84  0
             value = proxied;
 85  0
         }
 86  
 
 87  
         public Object getValue()
 88  
         {
 89  0
             return value;
 90  
         }
 91  
 
 92  
         public void setValue(Object value)
 93  
         {
 94  0
             this.value = value;
 95  0
         }   
 96  
     }
 97  
 
 98  
 }