Coverage report

  %line %branch
org.apache.commons.jelly.tags.xml.AttributeTag
91% 
90% 

 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.tags.xml;
 17  
 
 18  
 import org.apache.commons.jelly.JellyTagException;
 19  
 import org.apache.commons.jelly.TagSupport;
 20  
 import org.apache.commons.jelly.XMLOutput;
 21  
 
 22  
 /** Adds an XML attribute to the parent element tag like
 23  
   * the <code>&lt;xsl:attribute&gt;</code> tag.
 24  
   *
 25  
   * @author James Strachan
 26  
   * @version $Revision: 1.6 $
 27  
   */
 28  1
 public class AttributeTag extends TagSupport {
 29  
 
 30  
     /** the name of the attribute. */
 31  
     private String name;
 32  
 
 33  
 
 34  3
     public AttributeTag() {
 35  3
     }
 36  
 
 37  
     // Tag interface
 38  
     //-------------------------------------------------------------------------
 39  
     public void doTag(XMLOutput output) throws JellyTagException {
 40  3
         ElementTag tag = (ElementTag) findAncestorWithClass( ElementTag.class );
 41  3
         if ( tag == null ) {
 42  0
             throw new JellyTagException( "<attribute> tag must be enclosed inside an <element> tag" );
 43  
         }
 44  3
         tag.setAttributeValue( getName(), getBodyText( false ) );
 45  2
     }
 46  
 
 47  
     // Properties
 48  
     //-------------------------------------------------------------------------
 49  
 
 50  
     /**
 51  
      * @return the name of the attribute.
 52  
      */
 53  
     public String getName() {
 54  3
         return name;
 55  
     }
 56  
     /**
 57  
      * Sets the name of the attribute
 58  
      */
 59  
     public void setName(String name) {
 60  3
         this.name = name;
 61  3
     }
 62  
 }

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