Coverage report

  %line %branch
org.apache.commons.jelly.DynaBeanTagSupport
0% 
0% 

 1  
 /*
 2  
  * Copyright 2002,2004 The Apache Software Foundation.
 3  
  *
 4  
  * Licensed under the Apache License, Version 2.0 (the "License");
 5  
  * you may not use this file except in compliance with the License.
 6  
  * You may obtain a copy of the License at
 7  
  *
 8  
  *      http://www.apache.org/licenses/LICENSE-2.0
 9  
  *
 10  
  * Unless required by applicable law or agreed to in writing, software
 11  
  * distributed under the License is distributed on an "AS IS" BASIS,
 12  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 13  
  * See the License for the specific language governing permissions and
 14  
  * limitations under the License.
 15  
  */
 16  
 
 17  
 package org.apache.commons.jelly;
 18  
 
 19  
 import org.apache.commons.beanutils.DynaBean;
 20  
 import org.apache.commons.beanutils.DynaProperty;
 21  
 
 22  
 /** 
 23  
  * <p><code>DynaBeanTag</code> is a DynaTag implementation which uses a DynaBean
 24  
  * to store its attribute values in. Derived tags can then process this
 25  
  * DynaBean in any way it wishes.
 26  
  * </p>
 27  
  *
 28  
  * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
 29  
  * @version $Revision: 155420 $
 30  
  */
 31  
 
 32  
 public abstract class DynaBeanTagSupport extends DynaTagSupport {
 33  
 
 34  
     /** the DynaBean which is used to store the attributes of this tag. */
 35  
     private DynaBean dynaBean;
 36  
 
 37  0
     public DynaBeanTagSupport() {
 38  0
     }
 39  
     
 40  0
     public DynaBeanTagSupport(DynaBean dynaBean) {
 41  0
         this.dynaBean = dynaBean;
 42  0
     }
 43  
      
 44  
     /** Sets the context in which the tag will be run. */
 45  
     public void setContext(JellyContext context) throws JellyTagException {
 46  0
         this.context = context;
 47  0
         beforeSetAttributes();
 48  0
     }
 49  
     
 50  
     /** Sets an attribute value of this tag before the tag is invoked
 51  
      */
 52  
     public void setAttribute(String name, Object value) throws JellyTagException {
 53  0
         getDynaBean().set(name, value);
 54  0
     }
 55  
 
 56  
     /**
 57  
      * @return the type of the given attribute. By default just return
 58  
      * Object.class if this is not known.
 59  
      */
 60  
     public Class getAttributeType(String name) throws JellyTagException {
 61  0
         DynaProperty property = getDynaBean().getDynaClass().getDynaProperty(name);
 62  0
         if (property != null) {
 63  0
             return property.getType();
 64  
         }
 65  0
         return Object.class;
 66  
     }
 67  
     
 68  
     /** 
 69  
      * @return the DynaBean which is used to store the
 70  
      *  attributes of this tag
 71  
      */
 72  
     public DynaBean getDynaBean() {
 73  0
         return dynaBean;
 74  
     }
 75  
     
 76  
     /**
 77  
      * Sets the DynaBean which is used to store the
 78  
      *  attributes of this tag
 79  
      */
 80  
     public void setDynaBean(DynaBean dynaBean) {
 81  0
         this.dynaBean = dynaBean;
 82  0
     }
 83  
 
 84  
     /**
 85  
      * Callback to allow processing to occur before the attributes are about to be set
 86  
      */
 87  
     public void beforeSetAttributes() throws JellyTagException {
 88  0
     }
 89  
     
 90  
 }

This report is generated by jcoverage, Maven and Maven JCoverage Plugin.