Clover coverage report - Code Coverage for tapestry release 4.0-alpha-3
Coverage timestamp: Mon May 16 2005 09:05:49 EDT
file stats: LOC: 70   Methods: 3
NCLOC: 33   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
ComponentConstructorImpl.java - 100% 100% 100%
coverage
 1   
 // Copyright 2004, 2005 The Apache Software Foundation
 2   
 //
 3   
 // Licensed under the Apache License, Version 2.0 (the "License");
 4   
 // you may not use this file except in compliance with the License.
 5   
 // You may obtain a copy of the License at
 6   
 //
 7   
 //     http://www.apache.org/licenses/LICENSE-2.0
 8   
 //
 9   
 // Unless required by applicable law or agreed to in writing, software
 10   
 // distributed under the License is distributed on an "AS IS" BASIS,
 11   
 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 12   
 // See the License for the specific language governing permissions and
 13   
 // limitations under the License.
 14   
 
 15   
 package org.apache.tapestry.enhance;
 16   
 
 17   
 import java.lang.reflect.Constructor;
 18   
 
 19   
 import org.apache.hivemind.ApplicationRuntimeException;
 20   
 import org.apache.hivemind.Location;
 21   
 import org.apache.tapestry.services.ComponentConstructor;
 22   
 
 23   
 /**
 24   
  * @author Howard M. Lewis Ship
 25   
  * @since 4.0
 26   
  */
 27   
 public class ComponentConstructorImpl implements ComponentConstructor
 28   
 {
 29   
     private Location _location;
 30   
 
 31   
     private Constructor _constructor;
 32   
 
 33   
     private Object[] _parameters;
 34   
 
 35   
     /**
 36   
      * News instance of this class.
 37   
      * 
 38   
      * @param c
 39   
      *            the constructor method to invoke
 40   
      * @param parameters
 41   
      *            the parameters to pass to the constructor. These are retained, not copied.
 42   
      */
 43   
 
 44  545
     public ComponentConstructorImpl(Constructor c, Object[] parameters, Location location)
 45   
     {
 46  545
         _constructor = c;
 47  545
         _parameters = parameters;
 48  545
         _location = location;
 49   
     }
 50   
 
 51  462
     public Class getComponentClass()
 52   
     {
 53  462
         return _constructor.getDeclaringClass();
 54   
     }
 55   
 
 56  1244
     public Object newInstance()
 57   
     {
 58  1244
         try
 59   
         {
 60  1244
             return _constructor.newInstance(_parameters);
 61   
         }
 62   
         catch (Throwable ex)
 63   
         {
 64  1
             throw new ApplicationRuntimeException(EnhanceMessages.instantiationFailure(
 65   
                     _constructor,
 66   
                     ex), null, _location, ex);
 67   
         }
 68   
     }
 69   
 
 70   
 }