Coverage Report - org.apache.myfaces.view.facelets.tag.composite.CompositeComponentPropertyDescriptor
 
Classes in this File Line Coverage Branch Coverage Complexity
CompositeComponentPropertyDescriptor
0%
0/26
0%
0/4
1.5
 
 1  
 /*
 2  
  * Licensed to the Apache Software Foundation (ASF) under one
 3  
  * or more contributor license agreements.  See the NOTICE file
 4  
  * distributed with this work for additional information
 5  
  * regarding copyright ownership.  The ASF licenses this file
 6  
  * to you under the Apache License, Version 2.0 (the
 7  
  * "License"); you may not use this file except in compliance
 8  
  * with the License.  You may obtain a copy of the License at
 9  
  *
 10  
  *   http://www.apache.org/licenses/LICENSE-2.0
 11  
  *
 12  
  * Unless required by applicable law or agreed to in writing,
 13  
  * software distributed under the License is distributed on an
 14  
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 15  
  * KIND, either express or implied.  See the License for the
 16  
  * specific language governing permissions and limitations
 17  
  * under the License.
 18  
  */
 19  
 package org.apache.myfaces.view.facelets.tag.composite;
 20  
 
 21  
 import java.beans.IntrospectionException;
 22  
 import java.beans.PropertyDescriptor;
 23  
 import java.io.Externalizable;
 24  
 import java.io.IOException;
 25  
 import java.io.ObjectInput;
 26  
 import java.io.ObjectOutput;
 27  
 import java.util.Enumeration;
 28  
 import java.util.HashMap;
 29  
 import java.util.Map;
 30  
 
 31  
 /**
 32  
  * Serializable implementation of PropertyDescriptor
 33  
  * 
 34  
  * @author Leonardo Uribe (latest modification by $Author$)
 35  
  * @version $Revision$ $Date$
 36  
  */
 37  
 public class CompositeComponentPropertyDescriptor extends PropertyDescriptor 
 38  
     implements Externalizable
 39  
 {
 40  
     
 41  
     /**
 42  
      * Used for serialization only
 43  
      * 
 44  
      * @throws IntrospectionException
 45  
      */
 46  
     public CompositeComponentPropertyDescriptor() throws IntrospectionException
 47  
     {
 48  0
         super("a",null,null);
 49  0
     }
 50  
     
 51  
     public CompositeComponentPropertyDescriptor(String propertyName)
 52  
             throws IntrospectionException
 53  
     {
 54  0
         super(propertyName, null, null);
 55  0
     }
 56  
 
 57  
     public void readExternal(ObjectInput in) throws IOException,
 58  
             ClassNotFoundException
 59  
     {
 60  0
         setName((String) in.readObject());
 61  0
         setDisplayName((String) in.readObject());
 62  0
         setExpert(in.readBoolean());
 63  0
         setPreferred(in.readBoolean());
 64  0
         setShortDescription((String)in.readObject());
 65  
         
 66  0
         Map<String,Object> map = (Map) in.readObject();
 67  
         
 68  0
         for (Map.Entry<String, Object> entry : map.entrySet())
 69  
         {
 70  0
             setValue(entry.getKey(), entry.getValue());
 71  0
         }
 72  0
     }
 73  
 
 74  
     public void writeExternal(ObjectOutput out) throws IOException
 75  
     {
 76  0
         out.writeObject(getName());
 77  0
         out.writeObject(getDisplayName());
 78  0
         out.writeBoolean(isExpert());
 79  0
         out.writeBoolean(isPreferred());
 80  0
         out.writeObject(getShortDescription());
 81  
         
 82  
         // Properties that comes here are targets, default, required,
 83  
         // method-signature and type.
 84  0
         Map<String,Object> map = new HashMap<String, Object>(6,1);
 85  
         
 86  0
         for (Enumeration<String> e = attributeNames(); e.hasMoreElements();)
 87  
         {
 88  0
             String name = e.nextElement();
 89  0
             map.put(name, getValue(name));
 90  0
         }
 91  0
         out.writeObject(map);
 92  0
     }
 93  
 }