Clover coverage report - brownies library - 1.0-beta-1
Coverage timestamp: 月 8 16 2004 17:14:42 GMT+09:00
file stats: LOC: 63   Methods: 4
NCLOC: 30   Classes: 1
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover
 
 Source file Conditionals Statements Methods TOTAL
ConstructorRule.java 100% 91.7% 75% 88.9%
coverage coverage
 1   
 /*
 2   
  * brownies and its relative products are published under the terms
 3   
  * of the Apache Software License.
 4   
  * 
 5   
  * Created on 2004/08/14 17:28:37
 6   
  */
 7   
 package org.asyrinx.brownie.core.xml.digester;
 8   
 
 9   
 import org.apache.commons.beanutils.ConvertUtils;
 10   
 import org.apache.commons.digester.Rule;
 11   
 import org.asyrinx.brownie.core.lang.ClassUtils;
 12   
 import org.xml.sax.Attributes;
 13   
 
 14   
 /**
 15   
  * @author akima
 16   
  */
 17   
 public class ConstructorRule extends Rule {
 18   
 
 19   
     /**
 20   
      *  
 21   
      */
 22  1
     public ConstructorRule(Class clazz, Class[] paramTypes, String[] paramNames) {
 23  1
         super();
 24  1
         this.clazz = clazz;
 25  1
         this.paramTypes = paramTypes;
 26  1
         this.paramNames = paramNames;
 27   
     }
 28   
 
 29   
     private final Class clazz;
 30   
 
 31   
     private final Class[] paramTypes;
 32   
 
 33   
     private final String[] paramNames;
 34   
 
 35   
     /**
 36   
      * @see org.apache.commons.digester.Rule#begin(org.xml.sax.Attributes)
 37   
      * @deprecated
 38   
      */
 39  0
     public void begin(Attributes attributes) throws Exception {
 40  0
         execute(attributes);
 41   
     }
 42   
 
 43   
     /**
 44   
      * @see org.apache.commons.digester.Rule#begin(java.lang.String,
 45   
      *        java.lang.String, org.xml.sax.Attributes)
 46   
      */
 47  1
     public void begin(String namespace, String name, Attributes attributes) throws Exception {
 48  1
         execute(attributes);
 49   
     }
 50   
 
 51   
     /**
 52   
      * @throws InstantiationException
 53   
      */
 54  1
     private void execute(Attributes attributes) throws InstantiationException {
 55  1
         Object[] params = new Object[this.paramNames.length];
 56  1
         for (int i = 0; i < this.paramNames.length; i++) {
 57  1
             final String paramName = this.paramNames[i];
 58  1
             params[i] = ConvertUtils.convert(attributes.getValue(paramName), paramTypes[i]);
 59   
         }
 60  1
         final Object bean = ClassUtils.newObject(clazz, null, params);
 61  1
         digester.push(bean);
 62   
     }
 63   
 }