Coverage report

  %line %branch
org.apache.commons.jelly.tags.define.JellyBeanTag
73% 
92% 

 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.tags.define;
 18  
 
 19  
 import java.lang.reflect.Method;
 20  
 
 21  
 import org.apache.commons.beanutils.MethodUtils;
 22  
 
 23  
 import org.apache.commons.logging.Log;
 24  
 import org.apache.commons.logging.LogFactory;
 25  
 
 26  
 
 27  
 /**
 28  
  * Binds a Java bean to the given named Jelly tag so that the attributes of
 29  
  * the tag set the bean properties. After the body of this tag is invoked
 30  
  * then the beans invoke() method will be called, if the bean has one.
 31  
  *
 32  
  * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
 33  
  * @version $Revision: 155420 $
 34  
  */
 35  3
 public class JellyBeanTag extends BeanTag {
 36  
 
 37  
     /** The Log to which logging calls will be made. */
 38  18
     private static final Log log = LogFactory.getLog(JellyBeanTag.class);
 39  
 
 40  
     /** Empty parameter types for Method lookup */
 41  9
     private static final Class[] emptyParamTypes = {};
 42  
 
 43  
     /** the name of the method to invoke on the bean */
 44  
     private String method;
 45  
 
 46  
     // Properties
 47  
     //-------------------------------------------------------------------------
 48  
 
 49  
     /**
 50  
      * @return the method name to use, which defaults to 'run' for Runnable
 51  
      * objects
 52  
      */
 53  
     public String getMethod() {
 54  3
         if ( method == null ) {
 55  3
             return "run";
 56  
         }
 57  0
         return method;
 58  
     }
 59  
 
 60  
     /**
 61  
      * Sets the name of the method to invoke on the bean.
 62  
      * This defaults to "run" so that Runnable objects can be
 63  
      * invoked, but this property can be set to whatever is required,
 64  
      * such as "execute" or "invoke"
 65  
      */
 66  
     public void setMethod(String method) {
 67  0
         this.method = method;
 68  0
     }
 69  
 
 70  
 
 71  
     // Implementation methods
 72  
     //-------------------------------------------------------------------------
 73  
 
 74  
     protected Method getInvokeMethod( Class theClass ) {
 75  3
         Method invokeMethod =
 76  
             MethodUtils.getAccessibleMethod(
 77  
                 theClass,
 78  
                 getMethod(),
 79  
                 emptyParamTypes);
 80  
 
 81  3
         if ( invokeMethod == null ) {
 82  
         }
 83  3
         return invokeMethod;
 84  
     }
 85  
 }

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