Clover coverage report - Code Coverage for hivemind release 1.1-alpha-2
Coverage timestamp: Wed Feb 23 2005 09:59:04 EST
file stats: LOC: 134   Methods: 13
NCLOC: 85   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
BuilderParameter.java 83.3% 100% 100% 97.5%
coverage coverage
 1   
 // Copyright 2004, 2005 The Apache Software Foundation
 2   
 //
 3   
 // Licensed under the Apache License, Version 2.0 (the "License");
 4   
 // you may not use this file except in compliance with the License.
 5   
 // You may obtain a copy of the License at
 6   
 //
 7   
 //     http://www.apache.org/licenses/LICENSE-2.0
 8   
 //
 9   
 // Unless required by applicable law or agreed to in writing, software
 10   
 // distributed under the License is distributed on an "AS IS" BASIS,
 11   
 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 12   
 // See the License for the specific language governing permissions and
 13   
 // limitations under the License.
 14   
 
 15   
 package org.apache.hivemind.service.impl;
 16   
 
 17   
 import java.util.ArrayList;
 18   
 import java.util.HashMap;
 19   
 import java.util.Iterator;
 20   
 import java.util.List;
 21   
 import java.util.Map;
 22   
 
 23   
 import org.apache.hivemind.ServiceImplementationFactoryParameters;
 24   
 import org.apache.hivemind.impl.BaseLocatable;
 25   
 
 26   
 /**
 27   
  * Parameter object used with {@link org.apache.hivemind.service.impl.BuilderFactory}.
 28   
  * 
 29   
  * @author Howard Lewis Ship
 30   
  */
 31   
 public class BuilderParameter extends BaseLocatable
 32   
 {
 33   
     private String _className;
 34   
 
 35   
     private List _properties = new ArrayList();
 36   
 
 37   
     private List _parameters = new ArrayList();
 38   
 
 39   
     /** @since 1.1 */
 40   
     private Map _typeFacetMap = new HashMap();
 41   
 
 42   
     private List _events = new ArrayList();
 43   
 
 44   
     private String _initializeMethod;
 45   
 
 46   
     private boolean _autowireServices;
 47   
 
 48  464
     public String getClassName()
 49   
     {
 50  464
         return _className;
 51   
     }
 52   
 
 53  37
     public void addParameter(BuilderFacet facet)
 54   
     {
 55  37
         _parameters.add(facet);
 56   
     }
 57   
 
 58  464
     public List getParameters()
 59   
     {
 60  464
         return _parameters;
 61   
     }
 62   
 
 63  2874
     public void addProperty(BuilderFacet facet)
 64   
     {
 65  2874
         _properties.add(facet);
 66   
     }
 67   
 
 68  463
     public List getProperties()
 69   
     {
 70  463
         return _properties;
 71   
     }
 72   
 
 73   
     /** @since 1.1 */
 74  8
     public BuilderFacet getFacetForType(ServiceImplementationFactoryParameters factoryParameters,
 75   
             Class targetType)
 76   
     {
 77  8
         BuilderFacet result = (BuilderFacet) _typeFacetMap.get(targetType);
 78   
 
 79  8
         if (result == null)
 80   
         {
 81  8
             for (Iterator i = _properties.iterator(); i.hasNext();)
 82   
             {
 83  12
                 BuilderFacet facet = (BuilderFacet) i.next();
 84   
 
 85  12
                 if (facet.canAutowireConstructorParameter()
 86   
                         && facet.isAssignableToType(factoryParameters, targetType))
 87   
                 {
 88  3
                     result = facet;
 89  3
                     break;
 90   
                 }
 91   
             }
 92   
 
 93  8
             _typeFacetMap.put(targetType, result);
 94   
         }
 95   
 
 96  8
         return result;
 97   
     }
 98   
 
 99  424
     public void setClassName(String string)
 100   
     {
 101  424
         _className = string;
 102   
     }
 103   
 
 104  3
     public void addEventRegistration(EventRegistration registration)
 105   
     {
 106  3
         _events.add(registration);
 107   
     }
 108   
 
 109  463
     public List getEventRegistrations()
 110   
     {
 111  463
         return _events;
 112   
     }
 113   
 
 114  463
     public String getInitializeMethod()
 115   
     {
 116  463
         return _initializeMethod;
 117   
     }
 118   
 
 119  6
     public void setInitializeMethod(String string)
 120   
     {
 121  6
         _initializeMethod = string;
 122   
     }
 123   
 
 124  927
     public boolean getAutowireServices()
 125   
     {
 126  927
         return _autowireServices;
 127   
     }
 128   
 
 129  420
     public void setAutowireServices(boolean autowireServices)
 130   
     {
 131  420
         _autowireServices = autowireServices;
 132   
     }
 133   
 
 134   
 }