Coverage report

  %line %branch
org.apache.commons.jelly.tags.jms.PropertyTag
0% 
0% 

 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.jms;
 18  
 
 19  
 import org.apache.commons.jelly.JellyTagException;
 20  
 import org.apache.commons.jelly.MissingAttributeException;
 21  
 import org.apache.commons.jelly.TagSupport;
 22  
 import org.apache.commons.jelly.XMLOutput;
 23  
 
 24  
 /** Defines a property on an outer JMS Message tag
 25  
   *
 26  
   * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
 27  
   * @version $Revision: 1.5 $
 28  
   */
 29  0
 public class PropertyTag extends TagSupport {
 30  
 
 31  
     /** Stores the name of the property */
 32  
     private String name;
 33  
 
 34  
     /** Stores the value of the property */
 35  
     private Object value;
 36  
 
 37  
 
 38  
     // Tag interface
 39  
     //-------------------------------------------------------------------------
 40  
     public void doTag(XMLOutput output) throws MissingAttributeException, JellyTagException {
 41  0
         if ( name == null ) {
 42  0
             throw new MissingAttributeException("name");
 43  
         }
 44  0
         MessageTag tag = (MessageTag) findAncestorWithClass( MessageTag.class );
 45  0
         if ( tag == null ) {
 46  0
             throw new JellyTagException("<jms:property> tag must be within a <jms:message> tag");
 47  
         }
 48  
 
 49  0
         if ( value != null ) {
 50  0
             tag.addProperty(name, value);
 51  
         }
 52  
         else {
 53  0
             tag.addProperty(name, getBodyText());
 54  
         }
 55  0
     }
 56  
 
 57  
 
 58  
     // Properties
 59  
     //-------------------------------------------------------------------------
 60  
     /** Sets the name of the JMS property
 61  
       */
 62  
     public void setName(String name) {
 63  0
         this.name = name;
 64  0
     }
 65  
 
 66  
     /** Sets the value of the JMS property.
 67  
       * If no value is set then the body of the tag is used
 68  
       */
 69  
     public void setValue(Object value) {
 70  0
         this.value = value;
 71  0
     }
 72  
 }

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