Coverage Report - org.jtheque.core.spring.extension.JThequeActionBeanDefinitionParser
 
Classes in this File Line Coverage Branch Coverage Complexity
JThequeActionBeanDefinitionParser
0 %
0/7
0 %
0/2
1.333
 
 1  
 package org.jtheque.core.spring.extension;
 2  
 
 3  
 /*
 4  
  * This file is part of JTheque.
 5  
  *
 6  
  * JTheque is free software: you can redistribute it and/or modify
 7  
  * it under the terms of the GNU General Public License as published by
 8  
  * the Free Software Foundation, either version 3 of the License.
 9  
  *
 10  
  * JTheque is distributed in the hope that it will be useful,
 11  
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 12  
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 13  
  * GNU General Public License for more details.
 14  
  *
 15  
  * You should have received a copy of the GNU General Public License
 16  
  * along with JTheque.  If not, see <http://www.gnu.org/licenses/>.
 17  
  */
 18  
 
 19  
 import org.jtheque.core.managers.view.impl.actions.utils.CloseViewAction;
 20  
 import org.jtheque.core.managers.view.impl.actions.utils.DisplayViewAction;
 21  
 import org.springframework.beans.factory.support.BeanDefinitionBuilder;
 22  
 import org.springframework.beans.factory.xml.AbstractSimpleBeanDefinitionParser;
 23  
 import org.springframework.beans.factory.xml.ParserContext;
 24  
 import org.w3c.dom.Element;
 25  
 
 26  
 /**
 27  
  * A bean definition for the close and display elements of the jtheque namespace.
 28  
  *
 29  
  * @author Baptiste Wicht
 30  
  */
 31  
 public final class JThequeActionBeanDefinitionParser extends AbstractSimpleBeanDefinitionParser {
 32  
     private final String action;
 33  
 
 34  
     /**
 35  
      * Construct a new JThequeActionBeanDefinitionParser for an action.
 36  
      *
 37  
      * @param action The action (close or display).
 38  
      */
 39  
     public JThequeActionBeanDefinitionParser(String action) {
 40  0
         super();
 41  
 
 42  0
         this.action = action;
 43  0
     }
 44  
 
 45  
     @Override
 46  
     protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) {
 47  0
         builder.addConstructorArgValue(element.getAttribute("key"));
 48  0
         builder.addPropertyReference("view", element.getAttribute("view"));
 49  0
     }
 50  
 
 51  
     @Override
 52  
     protected Class<?> getBeanClass(Element element) {
 53  0
         return "close".equals(action) ? CloseViewAction.class : DisplayViewAction.class;
 54  
     }
 55  
 }