Clover coverage report - Apache Addressing - 1.0
Coverage timestamp: Tue Mar 22 2005 07:59:24 EST
file stats: LOC: 253   Methods: 15
NCLOC: 140   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
ReferenceParametersType.java 11.5% 15.8% 46.7% 19.4%
coverage coverage
 1   
 /*
 2   
  * Copyright  1999-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   
 
 18   
 package org.apache.axis.message.addressing;
 19   
 
 20   
 import org.apache.axis.encoding.AnyContentType;
 21   
 import org.apache.axis.message.MessageElement;
 22   
 import org.apache.axis.utils.XMLUtils;
 23   
 import org.apache.commons.logging.Log;
 24   
 import org.apache.commons.logging.LogFactory;
 25   
 import org.w3c.dom.Document;
 26   
 import org.w3c.dom.Element;
 27   
 
 28   
 import javax.xml.namespace.QName;
 29   
 import java.io.Serializable;
 30   
 
 31   
 /**
 32   
  * Java content class for ReferenceParametersType complex type.
 33   
  * <p>The following schema fragment specifies the expected content contained within this java content object. (defined at http://schemas.xmlsoap.org/ws/2004/08/addressing line 62)
 34   
  * <p>
 35   
  * <pre>
 36   
  * &lt;complexType name="ReferenceParametersType">
 37   
  *   &lt;complexContent>
 38   
  *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 39   
  *       &lt;sequence>
 40   
  *         &lt;any/>
 41   
  *       &lt;/sequence>
 42   
  *     &lt;/restriction>
 43   
  *   &lt;/complexContent>
 44   
  * &lt;/complexType>
 45   
  * </pre>
 46   
  * 
 47   
  * @author Davanum Srinivas (dims@yahoo.com)
 48   
  */
 49   
 public class ReferenceParametersType implements Serializable, AnyContentType { 
 50   
 
 51   
     private static Log log = 
 52   
         LogFactory.getLog(ReferenceParametersType.class.getName());
 53   
 
 54   
     private MessageElement [] _any;
 55   
 
 56   
     /**
 57   
      * Constructor ReferenceParameters
 58   
      */
 59  71
     public ReferenceParametersType() {
 60   
     }
 61   
     
 62   
     /**
 63   
      * Constructor ReferenceParameters
 64   
      */
 65  0
     public ReferenceParametersType(java.lang.Object element) {
 66  0
         add(element);
 67   
     }
 68   
 
 69   
     /**
 70   
      * Constructor ReferenceParameters (performs shallow copy)
 71   
      * 
 72   
      * @param properties
 73   
      */
 74  0
     public ReferenceParametersType(ReferenceParametersType properties) {
 75  0
         this(properties, false);
 76   
     }
 77   
     
 78   
     /**
 79   
      * Constructor ReferenceParameters
 80   
      * 
 81   
      * @param properties
 82   
      * @param deepCopy
 83   
      */
 84  13
     public ReferenceParametersType(ReferenceParametersType properties, 
 85   
                                    boolean deepCopy) {
 86  13
         if (properties == null) {
 87  0
             throw new IllegalArgumentException();
 88   
         }
 89  13
         MessageElement elem = null;
 90  13
         for (int i = 0; i < properties.size(); i++) {
 91  0
             elem = properties._any[i];
 92  0
             if (deepCopy) {
 93   
                 // deep copy
 94  0
                 try {
 95  0
                     add(new MessageElement(elem.getAsDOM()));
 96   
                 } catch (Exception e) {
 97   
                     // if failed just copy reference
 98  0
                     add(elem);
 99   
                 }
 100   
             } else {
 101   
                 // shallow copy
 102  0
                 add(elem);
 103   
             }
 104   
         }
 105   
     }
 106   
 
 107  13
     public int size() {
 108  13
         return (this._any == null) ? 0 : this._any.length;
 109   
     }
 110   
 
 111  0
     public Object get(int index) {
 112  0
         return this._any[index];
 113   
     }
 114   
 
 115   
     /**
 116   
      * Get a (single) MessageElement matching the passed QName
 117   
      * @param qname
 118   
      * @return
 119   
      */
 120  0
     public MessageElement get(QName qname) {
 121  0
         for (int i = 0; i < _any.length; i++) {
 122  0
             MessageElement messageElement = _any[i];
 123  0
             if (messageElement.getQName().equals(qname))
 124  0
                 return messageElement;
 125   
         }
 126  0
         return null;
 127   
     }
 128   
 
 129  0
     public void add(Object element) {
 130  0
         MessageElement value = null;
 131  0
         if (element instanceof MessageElement) {
 132  0
             value = (MessageElement)element;
 133  0
         } else if (element instanceof Element) {
 134  0
             value = new MessageElement((Element)element);
 135   
         } else {
 136  0
             throw new IllegalArgumentException();
 137   
         }
 138   
 
 139  0
         if (this._any == null) {
 140  0
             this._any = new MessageElement[] {value};
 141   
         } else {
 142  0
             MessageElement [] any = null;
 143  0
             any = new MessageElement[this._any.length + 1];
 144  0
             System.arraycopy(this._any, 0,
 145   
                              any, 0, 
 146   
                              this._any.length);
 147  0
             any[this._any.length] = value;
 148  0
             this._any = any;
 149   
         }
 150   
     }
 151   
 
 152   
     /**
 153   
      * append DOM node to parent
 154   
      * 
 155   
      * @param parent 
 156   
      */
 157  0
     public void append(Element parent, String elementName) {
 158  0
         Document doc = parent.getOwnerDocument();
 159  0
         Element refProp = doc.createElementNS(Constants.NS_URI_ADDRESSING_DEFAULT,
 160   
                                               elementName);
 161  0
         MessageElement [] any = get_any();
 162  0
         if (any != null) {
 163  0
             try {
 164  0
                 for (int i=0;i<any.length;i++) {
 165  0
                     refProp.appendChild(doc.importNode(any[i].getAsDOM(), 
 166   
                                                        true));
 167   
                 }
 168   
             } catch (Exception e) {
 169  0
                 log.debug("", e);
 170   
             }
 171   
         }
 172  0
         parent.appendChild(refProp);
 173   
     }
 174   
 
 175   
     /**
 176   
      * Gets the _any value for this ReferenceParametersType.
 177   
      * 
 178   
      * @return _any
 179   
      */
 180  3
     public MessageElement [] get_any() {
 181  3
         return _any;
 182   
     }
 183   
     
 184   
     /**
 185   
      * Sets the _any value for this ReferenceParametersType.
 186   
      * 
 187   
      * @param _any
 188   
      */
 189  0
     public void set_any(MessageElement [] _any) {
 190  0
         this._any = _any;
 191   
     }
 192   
     
 193  0
     public String toString() {
 194  0
         if (this._any == null) {
 195  0
             return "";
 196   
         }
 197  0
         StringBuffer buf = new StringBuffer();
 198  0
         for (int i=0;i<this._any.length;i++) {
 199  0
             buf.append("Reference property[" + i + "]:\n");
 200  0
             try {
 201  0
                 buf.append(XMLUtils.ElementToString(this._any[i].getAsDOM()));
 202   
             } catch (Exception e) {
 203  0
                 buf.append("<error converting: " + e.getMessage() + ">");
 204   
             }
 205  0
             buf.append("\n");
 206   
         }
 207  0
         return buf.toString();
 208   
     }
 209   
 
 210   
     // Type metadata
 211   
     private static org.apache.axis.description.TypeDesc typeDesc =
 212   
         new org.apache.axis.description.TypeDesc(ReferenceParametersType.class, true);
 213   
     
 214   
     static {
 215  5
         typeDesc.setXmlType(new javax.xml.namespace.QName(Constants.NS_URI_ADDRESSING_DEFAULT, "ReferenceParametersType"));
 216   
     }
 217   
 
 218   
     /**
 219   
      * Return type metadata object
 220   
      */
 221  1
     public static org.apache.axis.description.TypeDesc getTypeDesc() {
 222  1
         return typeDesc;
 223   
     }
 224   
 
 225   
 
 226   
     /**
 227   
      * Get Custom Serializer
 228   
      */
 229  3
     public static org.apache.axis.encoding.Serializer getSerializer(
 230   
            java.lang.String mechType, 
 231   
            java.lang.Class _javaType,  
 232   
            javax.xml.namespace.QName _xmlType) {
 233  3
         return 
 234   
           new  org.apache.axis.encoding.ser.BeanSerializer(
 235   
             _javaType, _xmlType, typeDesc);
 236   
     }
 237   
 
 238   
     /**
 239   
      * Get Custom Deserializer
 240   
      */
 241  2
     public static org.apache.axis.encoding.Deserializer getDeserializer(
 242   
            java.lang.String mechType, 
 243   
            java.lang.Class _javaType,  
 244   
            javax.xml.namespace.QName _xmlType) {
 245  2
         return 
 246   
           new  org.apache.axis.encoding.ser.BeanDeserializer(
 247   
             _javaType, _xmlType, typeDesc);
 248   
     }
 249   
 
 250   
 }
 251   
 
 252   
 
 253