Coverage report

  %line %branch
org.apache.commons.jelly.impl.DefaultTagFactory
31% 
100% 

 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  
 package org.apache.commons.jelly.impl;
 17  
 
 18  
 import org.apache.commons.jelly.JellyException;
 19  
 import org.apache.commons.jelly.Tag;
 20  
 
 21  
 import org.xml.sax.Attributes;
 22  
 
 23  
 /**
 24  
  * <p><code>DefaultTagFactory</code> a default implementation of TagFactory
 25  
  * which creates new instances of a given class.
 26  
  *
 27  
  * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
 28  
  * @version $Revision: 155420 $
 29  
  */
 30  
 public class DefaultTagFactory implements TagFactory {
 31  
 
 32  
     private Class tagClass;
 33  
 
 34  0
     public DefaultTagFactory() {
 35  0
     }
 36  
 
 37  19721
     public DefaultTagFactory(Class tagClass) {
 38  19721
         this.tagClass = tagClass;
 39  19721
     }
 40  
 
 41  
     // TagFactory interface
 42  
     //-------------------------------------------------------------------------
 43  
     public Tag createTag(String name, Attributes attributes) throws JellyException {
 44  
         try {
 45  9490
           return (Tag) tagClass.newInstance();
 46  0
         } catch (InstantiationException e) {
 47  0
             throw new JellyException(e.toString());
 48  0
         } catch (IllegalAccessException e) {
 49  0
             throw new JellyException(e.toString());
 50  
         }
 51  
     }
 52  
 
 53  
 
 54  
     // Properties
 55  
     //-------------------------------------------------------------------------
 56  
 
 57  
     /**
 58  
      * Returns the tagClass.
 59  
      * @return Class
 60  
      */
 61  
     public Class getTagClass() {
 62  0
         return tagClass;
 63  
     }
 64  
 
 65  
     /**
 66  
      * Sets the tagClass.
 67  
      * @param tagClass The tagClass to set
 68  
      */
 69  
     public void setTagClass(Class tagClass) {
 70  0
         this.tagClass = tagClass;
 71  0
     }
 72  
 
 73  
 }

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